From f13e1361359e08b578c48da8193efe44d66a380e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 21 Nov 2019 14:30:21 +0100 Subject: [PATCH] Bug fixed when Telegram API returns error --- Session.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Session.js b/Session.js index 6c791f314..c259426ed 100644 --- a/Session.js +++ b/Session.js @@ -491,9 +491,9 @@ if (socialBot.type === code.botType && socialBot.id === code.botId) { if (socialBot.type === "Telegram Bot") { if (announcement.formulaValue !== undefined) { - socialBot.botInstance.telegramAPI.sendMessage(socialBot.botInstance.chatId, announcement.formulaValue) + socialBot.botInstance.telegramAPI.sendMessage(socialBot.botInstance.chatId, announcement.formulaValue).catch(err => parentLogger.write(MODULE_NAME, "[WARN] initialize -> setUpSocialBots -> announce -> Telegram API error -> err = " + err)) } else { - socialBot.botInstance.telegramAPI.sendMessage(socialBot.botInstance.chatId, code.text) + socialBot.botInstance.telegramAPI.sendMessage(socialBot.botInstance.chatId, code.text).catch(err => parentLogger.write(MODULE_NAME, "[WARN] initialize -> setUpSocialBots -> announce -> Telegram API error -> err = " + err)) } } } @@ -523,7 +523,7 @@ const Telegram = require('telegraf/telegram') let telegramAPI telegramAPI = new Telegram(botToken) - telegramAPI.sendMessage(chatId, bot.SESSION.type + " '" + bot.SESSION.name + "' was Started.") + telegramAPI.sendMessage(chatId, bot.SESSION.type + " '" + bot.SESSION.name + "' was Started.").catch(err => parentLogger.write(MODULE_NAME, "[WARN] initialize -> setUpTelegramBot -> Telegram API error -> err = " + err)) let botInstance = { telegramBot: telegramBot,