Naltox / telegram-node-bot

Node module for creating Telegram bots.
MIT License
724 stars 143 forks source link

ending a inline menu? #107

Closed paOol closed 8 years ago

paOol commented 8 years ago

I would like to clear the message, or at least edit the initial message of any inline buttons.

I tried some stuff in the callback , but it just added messages into the chat rather than removing or editing the initial inline menu.

has anyone come up with a solution?

lenny76 commented 8 years ago

+1

bidadh commented 8 years ago

+1

paOol commented 8 years ago

editing the original message of an inline menu worked on a different bot I tested, so it's definitely possible with telegram's API.

Naltox commented 8 years ago

You can use sub menus in runInlineMenu - https://github.com/Naltox/telegram-node-bot#inline-menu

Or you can manual edit message by id using editMessageText method in api

paOol commented 8 years ago
    $.runInlineMenu({
          method: 'sendMessage',
          params: [`Image Results for ${query}`],
          menu: [{
            text: 'Find another result',
            callback: (callbackQuery) => {
              let id = $.message;
              console.log(id);

that gives me the message ID of the user who entered the command. how do I get the message ID of the runInlineMenu?

AndryFM commented 7 years ago

I use this way:

{
    text: 'Yes!',
        callback: (callbackQuery, message) => {
            $.api.editMessageText('new text', { chat_id: $.chatId, message_id: message.messageId })
    }
},
rotimi-best commented 5 years ago

@AndryFM Thanks. This worked but my inline buttons disappear. How do I do it in such a way that they don't disappear?

Image before clicking inline button: image

Image after clicking inline button: image