Why This Code Get User Messages in any Places or I mean in any Buttons.
With this code I will recieve user messages, and I excluded buttons and previous buttons, Because I need Just console log Users real messages(not Buttons Title), I need to get user Messages just when I'm in Contact us Button.
bot.on('message', (msg) => {
if (!locale.keyboards[msg.text] &&
!msg.text.includes("Previous Buttons ")) {
console.log("User Message is: " + msg.text)
const opts = {
reply_to_message_id: msg.message_id,
reply_markup: JSON.stringify({
keyboard: arrangeKeyboardWithOut(locale.keyboards["/start"].childs, 2, msg),
resize_keyboard: true,
one_time_keyboard: true
})
};
bot.sendMessage(msg.chat.id, 'Received your message', opts);
}
});
via Sedric Heidarizarei
No comments:
Post a Comment