fix bug with ctx.

This commit is contained in:
Timofey Gelazoniya 2022-10-20 19:54:24 +03:00
parent 3664440bf1
commit 3025421e34
Signed by: zeldon
GPG Key ID: 047886915281DD2A
2 changed files with 11 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules node_modules
dist dist
.env .env
balabola.tar.gz

View File

@ -11,14 +11,14 @@ const filter = composer
const selectStyleKeyboard = <C extends MessageContext>(ctx: C) => { const selectStyleKeyboard = <C extends MessageContext>(ctx: C) => {
return Keyboard.builder() return Keyboard.builder()
.textButton({ label: '1', payload: { command: 'пр 0 ' + ctx.text! } }) .textButton({ label: '1', payload: { command: 'пр 0 ' + ctx.$match[1] } })
.textButton({ label: '2', payload: { command: 'пр 24 ' + ctx.text! } }) .textButton({ label: '2', payload: { command: 'пр 24 ' + ctx.$match[1] } })
.textButton({ label: '3', payload: { command: 'пр 25 ' + ctx.text! } }) .textButton({ label: '3', payload: { command: 'пр 25 ' + ctx.$match[1] } })
.textButton({ label: '4', payload: { command: 'пр 11 ' + ctx.text! } }) .textButton({ label: '4', payload: { command: 'пр 11 ' + ctx.$match[1] } })
.row() .row()
.textButton({ label: '5', payload: { command: 'пр 6 ' + ctx.text! } }) .textButton({ label: '5', payload: { command: 'пр 6 ' + ctx.$match[1] } })
.textButton({ label: '6', payload: { command: 'пр 8 ' + ctx.text! } }) .textButton({ label: '6', payload: { command: 'пр 8 ' + ctx.$match[1] } })
.textButton({ label: '7', payload: { command: 'пр 9 ' + ctx.text! } }) .textButton({ label: '7', payload: { command: 'пр 9 ' + ctx.$match[1] } })
.row() .row()
.textButton({ label: 'чзх', payload: { command: 'help' } }) .textButton({ label: 'чзх', payload: { command: 'help' } })
.inline(); .inline();
@ -47,7 +47,7 @@ filter.hear(/^(?:пр)\s(1|2|3|4|5|6|7)\s(.*)?$/i, async ctx => {
const intro = ctx.$match[1]; const intro = ctx.$match[1];
const query = ctx.$match[2]; const query = ctx.$match[2];
await ctx.send('генерирую!!'); await ctx.send('генерирую!!!');
const result = await balabolaQueue.add(() => balabola(query, BALABOLA_INTROS[+intro - 1])); const result = await balabolaQueue.add(() => balabola(query, BALABOLA_INTROS[+intro - 1]));
await ctx.send(result); await ctx.send(result);
@ -55,6 +55,6 @@ filter.hear(/^(?:пр)\s(1|2|3|4|5|6|7)\s(.*)?$/i, async ctx => {
filter.use(async ctx => { filter.use(async ctx => {
if (ctx.isChat) return; if (ctx.isChat) return;
const result = await balabolaQueue.add(() => balabola(ctx.text!, 6)); const result = await balabolaQueue.add(() => balabola(ctx.text!, 0));
await ctx.send(result); await ctx.send(result);
}); });