Move discord webhook func to discord.js
This commit is contained in:
@@ -102,7 +102,7 @@ function messageDiscordChatChannel(messageString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageString = removeColoursInMessage(messageString);
|
messageString = removeColoursInMessage(messageString);
|
||||||
triggerWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_LOG);
|
triggerDiscordWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -121,7 +121,7 @@ function messageDiscordEventChannel(messageString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageString = removeColoursInMessage(messageString);
|
messageString = removeColoursInMessage(messageString);
|
||||||
triggerWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_LOG);
|
triggerDiscordWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -140,7 +140,31 @@ function messageDiscordAdminChannel(messageString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageString = removeColoursInMessage(messageString);
|
messageString = removeColoursInMessage(messageString);
|
||||||
triggerWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_ADMIN);
|
triggerDiscordWebHook(messageString, getServerId(), VRR_DISCORD_WEBHOOK_ADMIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function triggerDiscordWebHook(messageString, serverId = getServerId(), type = VRR_DISCORD_WEBHOOK_LOG) {
|
||||||
|
if (!getGlobalConfig().discord.webhook.enabled) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
Reference in New Issue
Block a user