Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]: Unite .command() and .callbackQuery() for Composer #220

Closed
LWJerri opened this issue May 25, 2022 · 3 comments
Closed

Comments

@LWJerri
Copy link

LWJerri commented May 25, 2022

Hello. Please, add support .command().callbackQuery(), because it's not work now.

What we have now:

async function startCommand(ctx: CustomContext) {
  await ctx.reply("Hello!");
}

composer.command("start", async (ctx) => await startCommand(ctx));
composer.callbackQuery("start", async (ctx) => await startCommand(ctx));

What I wanna get:

composer.callbackQuery("start").command("start", async (ctx) => await ctx.reply("Hello!"));
  • When I write this code I didn't get any response or error from the command or callback.
@rojvv
Copy link
Member

rojvv commented May 25, 2022

How have you understood callbackQuery?

@KnorpelSenf
Copy link
Member

If you chain method calls, they will be concatenated by AND. Here are the docs: https://grammy.dev/guide/filter-queries.html#combine-with-and

What you're doing by putting everything on one line is to filter for updates that are both commands and callback queries at the same time. This does not exist. If you send a command, it will not be a callback query (obviously) and vice-versa. That's why you don't get any resopnse.

@LWJerri
Copy link
Author

LWJerri commented May 26, 2022

If you chain method calls, they will be concatenated by AND. Here are the docs: https://grammy.dev/guide/filter-queries.html#combine-with-and

What you're doing by putting everything on one line is to filter for updates that are both commands and callback queries at the same time. This does not exist. If you send a command, it will not be a callback query (obviously) and vice-versa. That's why you don't get any resopnse.

Hello. Yeah, I understand it, but I forgot the queries filter. Thanks!

@LWJerri LWJerri closed this as completed May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants