alik0211 / mtproto-core

Telegram API JS (MTProto) client library for Node.js and browser
https://mtproto-core.js.org
GNU General Public License v3.0
625 stars 111 forks source link

sendMessage with buttons #261

Open 0x3ji opened 2 years ago

0x3ji commented 2 years ago

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' }, 
            ],
        ],
    },
});