some fixes

This commit is contained in:
2022-10-21 09:58:42 +03:00
parent 257d80f0f6
commit 565645817d
2 changed files with 27 additions and 2 deletions

View File

@ -38,8 +38,23 @@ const balabolaMessage = `Выбери стилизацию ответа:
const BALABOLA_INTROS = [0, 24, 25, 11, 6, 8, 9];
filter.hear(/^(?:продолжи)\s(.*)?$/i, async ctx => {
if (ctx.isChat) return;
const spammers = new Map<number, number>();
filter.use((ctx, next) => {
if (spammers.has(ctx.senderId) && spammers.get(ctx.senderId)! > Date.now()) {
return ctx.reply('отказ', { disable_mentions: true });
}
spammers.set(ctx.senderId, Date.now() + 5000);
return next();
});
filter.hear(/^(?:продолжи)\s(.*)?$/i, async (ctx, next) => {
if (ctx.isChat) {
ctx.text = `пр 1 ${ctx.$match[1]}`;
return next();
}
await ctx.send(balabolaMessage, {
keyboard: selectStyleKeyboard(ctx)
});
@ -56,6 +71,7 @@ filter.hear(/^(?:пр)\s(1|2|3|4|5|6|7)\s(.*)?$/i, async ctx => {
filter.use(async ctx => {
if (ctx.isChat) return;
await ctx.send('генерирую!!');
const result = await throttledBalabola(() => balabola(ctx.text!, 0));
await ctx.send(result);