Skip to content

Commit 4fb9ff1

Browse files
committed
refactor: Refactor webhook setup and remove rate limit decorator from handleMessage method
1 parent 14de19d commit 4fb9ff1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bot/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,14 @@ export class CopBot {
7171
} catch (err) {
7272
console.error('Failed to set webhook:', err);
7373
retries -= 1;
74-
if (retries === 0) throw err;
74+
if (retries === 0) {
75+
console.error('Exhausted all retries to set the webhook');
76+
throw err;
77+
}
7578
}
7679
}
80+
const webhookInfo = await this._bot.api.getWebhookInfo();
81+
console.log('web hook info:', webhookInfo);
7782
await this._bot.start({
7883
onStart: (botInfo) => {
7984
console.log(`Bot started in web-hook mode! Username: ${botInfo.username}`);
@@ -114,7 +119,6 @@ export class CopBot {
114119
}
115120
@SaveUserData()
116121
@MessageValidator()
117-
@RateLimit({ commandLimit: 3, timeFrame: 15000 })
118122
@Catch()
119123
async handleMessage(ctx: Context) {
120124
console.log('ctx.message.text:', ctx.message?.text);

0 commit comments

Comments
 (0)