I am encountering a problem with my Telegram bot when trying to send a user’s contact information. The console logs the following error message:
error: [polling_error] {}
While the contact information is sent successfully and all other commands function properly, this specific error occurs only during the process of sending the user’s contact. Here is a simplified version of my code:
bot.telegramBot.on("message", (message) => {
const chatId = message.chat.id; // destructuring
const senderName = message.from.first_name; // destructuring
if (message.text.toLowerCase() === "/start") {
bot.telegramBot.sendMessage(
chatId,
`${senderName}, welcome to MyClub Telegram Bot! Please share your phone number to proceed.`,
{
reply_markup: {
keyboard: [[{ text: "Send", request_contact: true }]],
},
}
);
}
});
I’ve searched online and found that this could be an unhandled error or a potential syntax issue, but I’m unsure about the root cause here. Any assistance would be greatly appreciated! Thank you!