Merge branch 'Superalgos:develop' into develop

This commit is contained in:
B Harrell committed 2021-05-07 13:16:57 -05:00
commit 1e062d73ec
3 files changed
+6 -9

No files matched your search

@@ -19,7 +19,6 @@ exports.newSuperalgosBotModulesDiscordBot = function (processIndex) {
const message = "Discord bot has started."
thisObject.sendMessage(message).catch(err => parentLogger.write(MODULE_NAME, "[WARN] initializeDiscordBot -> Discord error -> err = " + err))
} catch (err) {
parentLogger.write(MODULE_NAME, "[WARN] initialize -> err = " + err.stack);
}
@@ -32,10 +31,10 @@ exports.newSuperalgosBotModulesDiscordBot = function (processIndex) {
}
function sendMessage(message) {
const https = require('https');
const https = require('https')
try {
message = JSON.stringify(message);
message = JSON.stringify({content: message})
} catch (err) {
parentLogger.write(MODULE_NAME, "[WARN] announce -> Discord JSON message error -> err = " + err)
}
@@ -43,7 +42,7 @@ exports.newSuperalgosBotModulesDiscordBot = function (processIndex) {
return new Promise((resolve, reject) => {
const requestOptions = {
method: 'POST',
header: { 'Content-Type': 'application/json' }
headers: { 'Content-Type': 'application/json' }
}
const req = https.request(thisObject.webhookURL, requestOptions, (res) => {
@@ -21,7 +21,7 @@ exports.newSuperalgosBotModulesSocialBots = function (processIndex) {
socialBot.botInstance.initialize(config.botToken, config.chatId)
} else if (socialBot.type === "Discord Bot"){
let config = socialBot.config
socialBot.botInstance = TS.projects.superalgos.botModules.discordBot.newSuperalgosBotModulesTelegramBot(processIndex)
socialBot.botInstance = TS.projects.superalgos.botModules.discordBot.newSuperalgosBotModulesDiscordBot(processIndex)
socialBot.botInstance.initialize(config.webhookURL)
}
}
@@ -82,11 +82,9 @@ function newSuperalgosFunctionLibrarySocialBotsFunctions() {
return
}
let params = {
text: "Test message from Superalgos!"
}
let message = "Test message from Superalgos!"
httpRequestJSON(JSON.stringify(params), webhookURL, onResponse)
httpRequestJSON(JSON.stringify({content: message}), webhookURL, onResponse)
function onResponse(err) {
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {