Superalgos Beta 7, first commit.

This commit is contained in:
Luis Fernando Molina committed 2020-11-05 10:38:10 +01:00
1 parent c877072b7c
commit eb427eb146
63 files changed
+4339 -458

No files matched your search

+16 -16
View File
@@ -13,10 +13,10 @@ exports.newSocialBots = function newSocialBots(bot, logger) {
return thisObject
function initialize() {
if (bot.SESSION.socialBots !== undefined) {
if (bot.SESSION.socialBots.bots !== undefined) {
for (let i = 0; i < bot.SESSION.socialBots.bots.length; i++) {
let socialBot = bot.SESSION.socialBots.bots[i]
if (bot.TRADING_SESSION.socialBots !== undefined) {
if (bot.TRADING_SESSION.socialBots.bots !== undefined) {
for (let i = 0; i < bot.TRADING_SESSION.socialBots.bots.length; i++) {
let socialBot = bot.TRADING_SESSION.socialBots.bots[i]
if (socialBot.type === "Telegram Bot") {
let config = socialBot.config
socialBot.botInstance = TELEGRAM_BOT_MODULE.newTelegramBot(bot, logger)
@@ -26,9 +26,9 @@ exports.newSocialBots = function newSocialBots(bot, logger) {
}
function announce(text) {
if (bot.SESSION.socialBots.bots !== undefined) {
for (let i = 0; i < bot.SESSION.socialBots.bots.length; i++) {
let socialBot = bot.SESSION.socialBots.bots[i]
if (bot.TRADING_SESSION.socialBots.bots !== undefined) {
for (let i = 0; i < bot.TRADING_SESSION.socialBots.bots.length; i++) {
let socialBot = bot.TRADING_SESSION.socialBots.bots[i]
try {
if (socialBot.type === "Telegram Bot") {
socialBot.botInstance.telegramAPI.sendMessage(socialBot.botInstance.chatId, text).catch(err => logger.write(MODULE_NAME, "[WARN] initialize -> initializeSocialBots -> announce -> Telegram API error -> err = " + err))
@@ -40,15 +40,15 @@ exports.newSocialBots = function newSocialBots(bot, logger) {
}
}
bot.SESSION.socialBots.announce = announce
bot.TRADING_SESSION.socialBots.announce = announce
}
}
function finalize() {
if (bot.SESSION.socialBots === undefined) { return }
if (bot.SESSION.socialBots.bots !== undefined) {
for (let i = 0; i < bot.SESSION.socialBots.bots.length; i++) {
let socialBot = bot.SESSION.socialBots.bots[i]
if (bot.TRADING_SESSION.socialBots === undefined) { return }
if (bot.TRADING_SESSION.socialBots.bots !== undefined) {
for (let i = 0; i < bot.TRADING_SESSION.socialBots.bots.length; i++) {
let socialBot = bot.TRADING_SESSION.socialBots.bots[i]
if (socialBot.type === "Telegram Bot") {
socialBot.botInstance.finalize()
}
@@ -57,10 +57,10 @@ exports.newSocialBots = function newSocialBots(bot, logger) {
}
function sendMessage(message) {
if (bot.SESSION.socialBots !== undefined) {
if (bot.SESSION.socialBots.bots !== undefined) {
for (let i = 0; i < bot.SESSION.socialBots.bots.length; i++) {
let socialBot = bot.SESSION.socialBots.bots[i]
if (bot.TRADING_SESSION.socialBots !== undefined) {
if (bot.TRADING_SESSION.socialBots.bots !== undefined) {
for (let i = 0; i < bot.TRADING_SESSION.socialBots.bots.length; i++) {
let socialBot = bot.TRADING_SESSION.socialBots.bots[i]
if (socialBot.type === "Telegram Bot") {
socialBot.botInstance.sendMessage(message)
}