Announcements working

This commit is contained in:
Luis Fernando Molina committed 2020-06-24 22:32:22 +02:00
1 parent ff922bf797
commit 3241a646cc
3 files changed
+12 -12

No files matched your search

+3 -3
View File
@@ -373,7 +373,7 @@
const logText = "User Defined End Datetime reached @ " + previousDay.getUTCFullYear() + "/" + (previousDay.getUTCMonth() + 1) + "/" + previousDay.getUTCDate() + ".";
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processDailyFiles -> advanceTime -> " + logText); }
bot.STOP_SESSION = true
bot.SESSION.stop(logText)
callBackFunction(global.DEFAULT_OK_RESPONSE);
return;
}
@@ -633,12 +633,12 @@
const logText = "User Defined End Datetime reached @ " + now.getUTCFullYear() + "/" + (now.getUTCMonth() + 1) + "/" + now.getUTCDate() + ".";
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processDailyFiles -> buildCharts -> onOutputGenerated -> onMarketStatusReport -> " + logText); }
bot.STOP_SESSION = true
bot.SESSION.stop('because it just finished.')
callBackFunction(global.DEFAULT_OK_RESPONSE);
return;
}
if (bot.SESSION.type === 'Backtesting Session') {
bot.STOP_SESSION = true
bot.SESSION.stop('Backtesting Session over Market Files Finished.')
}
callBackFunction(global.DEFAULT_OK_RESPONSE);
}
+4 -4
View File
@@ -100,7 +100,7 @@
bot.STOP_SESSION = true
}
socialBotsModule.sendMessage(bot.SESSION.type + " '" + bot.SESSION.name + "' was started.")
socialBotsModule.sendMessage(bot.SESSION.type + " '" + bot.SESSION.name + "' is starting.")
} catch (err) {
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> runSession -> err = " + err.stack);
}
@@ -108,10 +108,10 @@
function stopSession(commandOrigin) {
try {
if (reason === undefined) { commandOrigin = ' from the User Interface.' }
socialBotsModule.sendMessage(bot.SESSION.type + " '" + bot.SESSION.name + "' was stopped " + commandOrigin)
bot.STOP_SESSION = true
if (commandOrigin === undefined) { commandOrigin = ' from the User Interface.' }
socialBotsModule.sendMessage(bot.SESSION.type + " '" + bot.SESSION.name + "' is stopping " + commandOrigin)
socialBotsModule.finalize()
bot.STOP_SESSION = true
} catch (err) {
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> stopSession -> err = " + err.stack);
}
+5 -5
View File
@@ -30,8 +30,8 @@ exports.newTelegramBot = function newTelegramBot(bot, logger) {
thisObject.telegramAPI = new Telegram(botToken)
const messge = bot.SESSION.type + " '" + bot.SESSION.name + "' was started."
thisObject.telegramAPI.sendMessage(thisObject.chatId, messge).catch(err => parentLogger.write(MODULE_NAME, "[WARN] initializeTelegramBot -> Telegram API error -> err = " + err))
const message = "Telegram bot is starting."
thisObject.telegramAPI.sendMessage(thisObject.chatId, message).catch(err => parentLogger.write(MODULE_NAME, "[WARN] initializeTelegramBot -> Telegram API error -> err = " + err))
} catch (err) {
parentLogger.write(MODULE_NAME, "[WARN] initialize -> err = " + err.stack);
@@ -40,12 +40,12 @@ exports.newTelegramBot = function newTelegramBot(bot, logger) {
}
function finalize() {
const messge = "I have been ordered to shut down. Goodbye!"
telegramAPI.sendMessage(thisObject.chatId, messge).catch(err => parentLogger.write(MODULE_NAME, "[WARN] finalize -> Telegram API error -> err = " + err))
const message = "Telegram bot is signing off."
thisObject.telegramAPI.sendMessage(thisObject.chatId, message).catch(err => parentLogger.write(MODULE_NAME, "[WARN] finalize -> Telegram API error -> err = " + err))
}
function sendMessage(message) {
thisObject.telegramAPI.sendMessage(thisObject.chatId, messge).catch(err => parentLogger.write(MODULE_NAME, "[WARN] announce -> Telegram API error -> err = " + err))
thisObject.telegramAPI.sendMessage(thisObject.chatId, message).catch(err => parentLogger.write(MODULE_NAME, "[WARN] announce -> Telegram API error -> err = " + err))
}
}