mtproto-core icon indicating copy to clipboard operation
mtproto-core copied to clipboard

sendMessage with buttons

Open 0x3ji opened this issue 2 years ago • 0 comments

Hi, would you mind asking how to sendMessage with button options. I saw from the source code seems reply_markup is supported, but turn out the followings throw an error. Would anybody can help with this. Thank you so much

api.call('messages.sendMessage', {
    background: false,
    slient: false,
    peer: { _: 'inputPeerChat', chat_id: chatId },
    message: '🤖 Where do you want to go?',
    random_id: Math.ceil(Math.random() * 0xffffff) + Math.ceil(Math.random() * 0xffffff),
    reply_to_msg_id: id,
    reply_markup: {
        inline_keyboard: [
            [
                { text: 'A', callback_data: 'A1' }, 
                { text: 'B', callback_data: 'B1' }, 
            ],
        ],
    },
});

0x3ji avatar May 23 '22 18:05 0x3ji