Skip to content

Help to understand callback #68

@Sozik87

Description

@Sozik87

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions