Closed alexkomsp closed 1 year ago
@alexkomsp, Hi)
Three parameters are passed to the sendMessage
function: _chatid, message, and an options object. You are passing 4 parameters, splitting the option into two objects. Below is a solution that should help.
const keyboardButtons = {
reply_markup: {
inline_keyboard: [
[{text: 'Btn1', callback_data: 'test1'}],
[{text: 'Btn2', callback_data: 'test2'}],
]
})
}
bot.on('message', async (msg) => {
const chatId = msg.chat.id;
const text = msg.text;
const topic = {};
if (msg.is_topic_message) {
topic.message_thread_id = msg.message_thread_id;
}
if (text === 'test') {
await bot.sendMessage(chatId, 'some text', Object.assign(topic, keyboardButtons) );
}
@VDS13 Hi!) It works! Thank you so much!
Can't figured out how to send inline_keyboard into topic of group. It works only in "General" topic.
My code:
It sended just 'some text' without keyboardButtons