File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,16 +31,22 @@ export class CopBot {
3131 const web_hook = Config . web_hook ;
3232 const isProduction = Config . environment === 'production' ;
3333 if ( isProduction ) {
34- const server = http . createServer ( webhookCallback ( this . _bot , 'http' ) ) ;
34+ const server = http . createServer ( webhookCallback ( this . _bot , 'http' , { timeoutMilliseconds : 30000 } ) ) ;
3535 server . listen ( port , '0.0.0.0' , ( ) => {
3636 console . log ( `Bot started on port ${ port } ` ) ;
3737 } ) ;
3838 try {
3939 await this . _bot . api . setWebhook ( `${ web_hook } ` ) ;
4040 console . log ( `Webhook set successfully to: ${ web_hook } ` ) ;
41- } catch ( error ) {
42- console . error ( 'Error setting webhook:' , error ) ;
43- process . exit ( 1 ) ;
41+ const webhookStatus = await this . _bot . api . getWebhookInfo ( ) ;
42+ if ( webhookStatus . url ) {
43+ console . log ( `Webhook is already set to: ${ webhookStatus . url } ` ) ;
44+ } else {
45+ console . log ( 'No webhook set.' ) ;
46+ }
47+ } catch ( error :any ) {
48+ console . error ( 'Error setting webhook:' , error . message || error . stack ) ;
49+ process . exit ( 1 ) ; // Exit if critical error
4450 }
4551 } else {
4652 try {
You can’t perform that action at this time.
0 commit comments