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

Help to understand callback #68

Open
Sozik87 opened this issue Dec 2, 2023 · 0 comments
Open

Help to understand callback #68

Sozik87 opened this issue Dec 2, 2023 · 0 comments

Comments

@Sozik87
Copy link

Sozik87 commented Dec 2, 2023

Hello friends! :)

Thank you for this project!

Please help me, I can't think of a solution to run the /run docker ps command by button.

bot.command("test_command", function (msg, reply, next) {
  reply.inlineKeyboard([
    [
      { text: "Run docker ps", callback_data: "1" }
    ]
  ]);

  reply.markdown("Please, choose an action");
});

bot.callback((query, next)=>{
        if (query.data === '1') {
                reply.text('/run docker ps').forceReply();
        } else {
                return next()
        }
});

I can't figure out how exactly to write bot.callback so(or something else) that the /run docker ps command (or all other commands with /run) will be executed when the button is pressed in the terminal.

Unfortunately I am very weak with JS.

P.S I was able to figure out how to use /setcommands through BotFather, but I would like to use the button.

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

1 participant