11import TelegramBot , { Message } from 'node-telegram-bot-api' ;
22import { getMapAvailability , getMapData , getMapIframeUrl , getMapMetadata , MapNode } from './bubblemapsService' ;
33import { generateMapScreenshot } from './screenshotService' ;
4- import axios from 'axios' ;
54
65const bot = new TelegramBot ( process . env . BOT_TOKEN as string ) ;
76
8-
97export function registerCommands ( ) {
108
119 bot . onText ( / \/ s t a r t / , ( msg : Message ) => {
@@ -18,6 +16,8 @@ export function registerCommands() {
1816 // /help
1917 bot . onText ( / \/ h e l p / , ( msg : Message ) => {
2018 const chatId = msg . chat . id ;
19+ console . log ( `[LOG] Help command requested by user ${ msg . from ?. id } (${ msg . from ?. username || 'unknown' } )` ) ;
20+ console . log ( `[LOG] Chat ID: ${ chatId } ` ) ;
2121 bot . sendMessage ( chatId , `Here are the available commands:
2222
2323 🔹 Basic Commands:
@@ -53,14 +53,17 @@ export function registerCommands() {
5353 // /map [chain] [token]
5454 bot . onText ( / \/ m a p (?: \s + ( \w + ) \s + ( 0 x [ a - f A - F 0 - 9 ] + ) ) ? / , async ( msg : Message , match : RegExpExecArray | null ) => {
5555 const chatId = msg . chat . id ;
56+ console . log ( `[LOG] Map command requested by user ${ msg . from ?. id } (${ msg . from ?. username || 'unknown' } )` ) ;
5657
5758 if ( ! match || match . length < 3 || ! match [ 1 ] || ! match [ 2 ] ) {
59+ console . log ( `[LOG] Invalid map command parameters` ) ;
5860 bot . sendMessage ( chatId , 'Please provide both chain and token address. Example: /map bsc 0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95' ) ;
5961 return ;
6062 }
6163
6264 const chain = match [ 1 ] . toLowerCase ( ) ;
6365 const token = match [ 2 ] ;
66+ console . log ( `[LOG] Fetching map for chain: ${ chain } , token: ${ token } ` ) ;
6467
6568 bot . sendMessage ( chatId , `🔍 Fetching map data for ${ token } on ${ chain } ...` ) ;
6669
@@ -107,7 +110,7 @@ export function registerCommands() {
107110 bot . sendMessage ( chatId , 'Please provide both chain and token address. Example: /score bsc 0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95' ) ;
108111 return ;
109112 }
110-
113+
111114 const chain = match [ 1 ] . toLowerCase ( ) ;
112115 const token = match [ 2 ] ;
113116
@@ -151,14 +154,17 @@ export function registerCommands() {
151154 // /screenshot [chain] [token]
152155 bot . onText ( / \/ s c r e e n s h o t \s + ( \w + ) \s + ( 0 x [ a - f A - F 0 - 9 ] + ) / , async ( msg : Message , match : RegExpExecArray | null ) => {
153156 const chatId = msg . chat . id ;
157+ console . log ( `[LOG] Screenshot command requested by user ${ msg . from ?. id } (${ msg . from ?. username || 'unknown' } )` ) ;
154158
155159 if ( ! match || match . length < 3 ) {
160+ console . log ( `[LOG] Invalid screenshot command parameters` ) ;
156161 bot . sendMessage ( chatId , 'Please provide both chain and token address. Example: /screenshot bsc 0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95' ) ;
157162 return ;
158163 }
159164
160165 const chain = match [ 1 ] . toLowerCase ( ) ;
161166 const token = match [ 2 ] ;
167+ console . log ( `[LOG] Generating screenshot for chain: ${ chain } , token: ${ token } ` ) ;
162168
163169 bot . sendMessage ( chatId , `📸 Generating screenshot for ${ token } on ${ chain } . This may take a moment...` ) ;
164170
0 commit comments