I’m developing a Telegram bot to dispatch messages, but occasionally it sends out two identical messages in response. Here is my code snippet:
export async function sendToTelegram(message: string) {
const telegramBot = new TelegramBot(TELEGRAM_BOT_TOKEN, {polling: false});
const groupId = parseInt(TELEGRAM_GROUP_ID);
try {
await telegramBot.sendMessage(groupId, message, {parse_mode: 'Markdown'});
} catch (err) {
logger.error(`Telegram error: ${err}`);
}
}
I’ve reviewed the documentation for the bot but haven’t found any information regarding this issue. I’m currently at a loss about what might be causing the duplicate messages.