From 2e838e3117c28da297736a1b1ccf9309d4b5e004 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sun, 10 Apr 2022 00:02:52 -0500 Subject: [PATCH] Fix webhook func --- scripts/server/utilities.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js index e6b5542b..32df26a5 100644 --- a/scripts/server/utilities.js +++ b/scripts/server/utilities.js @@ -395,22 +395,22 @@ function getClientFromSyncerId(syncerId) { // =========================================================================== -async function triggerWebHook(webHookURL, messageString) { - return new Promise(resolve => { - let tempURL = getGlobalConfig().discord.webhook.baseURL; - tempURL = tempURL.replace("{0}", messageString); - tempURL = tempURL.replace("{1}", webHookURL); +function triggerWebHook(messageString, serverId = getServerId(), type = VRR_DISCORD_WEBHOOK_LOG) { + let tempURL = getGlobalConfig().discord.webhook.webhookBaseURL; + tempURL = tempURL.replace("{0}", encodeURI(messageString)); + tempURL = tempURL.replace("{1}", serverId); + tempURL = tempURL.replace("{2}", type); + tempURL = tempURL.replace("{3}", getGlobalConfig().discord.webhook.pass); - httpGet( - tempURL, - "", - function(data) { - //console.warn(JSON.parse(data)); - }, - function(data) { - } - ); - }); + httpGet( + tempURL, + "", + function(data) { + + }, + function(data) { + } + ); } // ===========================================================================