announcements improved

This commit is contained in:
Luis Fernando Molina committed 2020-04-01 14:28:57 +02:00
1 parent 6798b4bf0f
commit ae6517bf56
2 files changed
+37 -34

No files matched your search

+8 -6
View File
@@ -513,12 +513,14 @@
let socialBot = bot.SESSION.socialBots.bots[i]
try {
let code = announcement.code
if (socialBot.id === announcement.referenceParent.id) {
if (socialBot.type === "Telegram Bot") {
if (announcement.formulaValue !== undefined) {
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).catch(err => parentLogger.write(MODULE_NAME, "[WARN] initialize -> setUpSocialBots -> announce -> Telegram API error -> err = " + err))
if (announcement.referenceParent !== undefined) {
if (socialBot.id === announcement.referenceParent.id) {
if (socialBot.type === "Telegram Bot") {
if (announcement.formulaValue !== undefined) {
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).catch(err => parentLogger.write(MODULE_NAME, "[WARN] initialize -> setUpSocialBots -> announce -> Telegram API error -> err = " + err))
}
}
}
}