grammyjs / grammyjs/stateless-question

[BUG] Always asking the question when entering the chat

Open
#4 9 comments 0 reactions 0 assignees View on GitHub
bot-api-limitation
Dominant language
TypeScript
Stars
42
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Following the conversation on [issue #119 in telegraf-inline-menu](https://github.com/EdJoPaTo/telegraf-inline-menu/issues/119) I have used stalessquestion to get input from a user on a menu button click.
The problem that answering or not the question, every time the user exits (not leave) the chat, and go back to it, the question is displayed. I don't know why. I think it is a kind of bug or maybe a misunderstanding on the way to use the library.

Any help is welcomed.

```
const menu = new MenuTemplate(() => 'Main Menu\n' + new Date().toISOString())

const menuTemplate = new MenuTemplate(ctx => `Menu Template for ${ctx.match![1]}`)
const statelessQuestion = new TelegrafStatelessQuestion('stateless', async (ctx) => {
await replyMenuToContext(WHAT_DO_IH_AVE_TO_PUT_HERE, ctx, menuPath);
});

bot.use(referralQuestion.middleware());
menuTemplate.interact('Default', 'default', {
do: async (ctx, path) => {
statelessQuestion.replyWithMarkdown(ctx,
'Please enter the new text for ' + ctx.match![1] + '.[ ](http://t.me/#menupath'
+ path //ctx.match![0]
+ ')');
return true;
}
});

const subMenu = new MenuTemplate('Submenu')
subMenu.chooseIntoSubmenu('items', ['item1', 'item2'], menuTemplate, {columns: 1});

menu.submenu('Submenu', 'submenu', subMenu);
const menuMiddleware = new MenuMiddleware('/', menu);
bot.use(menuMiddleware.middleware());

bot.command('openmenu', async (ctx) => menuMiddleware.replyToContext(ctx));
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.