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

How to get callback_data from context #1127

Closed
Aliph0th opened this issue Aug 20, 2023 · 1 comment
Closed

How to get callback_data from context #1127

Aliph0th opened this issue Aug 20, 2023 · 1 comment

Comments

@Aliph0th
Copy link

I have a lot of inline buttons that change the language of the bot.
I want to make one function in my AppUpdate that would change the language depending on the callback_data of the button that was pressed:

@Action(['en', 'ru', ...])
   async changeLanguage(@Ctx() ctx: Context) {
      await ctx.deleteMessage();
      ctx.session.language = ??????????????
     ...
   }

Buttons:

export default Markup.inlineKeyboard([
   [Markup.button.callback('🇬🇧 English', 'en')],
   [Markup.button.callback('🇷🇺 Русский', 'ru')],
  ...
]);

@unnaidan
Copy link

unnaidan commented May 14, 2024

Hello @Aliph0th, how did you solve this?

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

2 participants