Compare commits
No commits in common. "1d5c29564f17029e224750855c237e7cc5d8d1ea" and "7ea30c8c71290f0b6e4570935765f6b1d5601b64" have entirely different histories.
1d5c29564f
...
7ea30c8c71
9
bot.js
9
bot.js
|
@ -9,10 +9,11 @@ const { limit } = require("@grammyjs/ratelimiter");
|
||||||
const bot = new Telegraf(BOT_API_KEY);
|
const bot = new Telegraf(BOT_API_KEY);
|
||||||
bot.catch((err) => console.log(err));
|
bot.catch((err) => console.log(err));
|
||||||
bot.use(limit({
|
bot.use(limit({
|
||||||
// default config: 1 message per 1 second
|
// default config: 5 messages per 5 seconds
|
||||||
timeFrame: RATE_TIMEFRAME ?? 1000,
|
timeFrame: RATE_TIMEFRAME ?? 5000,
|
||||||
limit: RATE_LIMIT ?? 1,
|
limit: RATE_LIMIT ?? 5,
|
||||||
keyGenerator: (ctx) => ctx.chat?.id.toString() ?? ctx.from?.id.toString(),
|
|
||||||
|
onLimitExceeded: (ctx, next) => ctx.reply('Too many requests!'),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
|
|
Loading…
Reference in New Issue