Add clan discord webhook func

This commit is contained in:
Vortrex
2022-07-27 00:44:07 -05:00
parent f4adc3c3e9
commit 9cedecf40c
2 changed files with 52 additions and 2 deletions

View File

@@ -155,6 +155,29 @@ function messageDiscordAdminChannel(messageString) {
// ===========================================================================
function messageDiscordClanWebhook(clanIndex, requiredFlagValue, messageString) {
if (getServerConfig().devServer == true) {
return false;
}
if (!getGlobalConfig().discord.sendClan) {
return false;
}
if (!getServerConfig().discord.sendClan) {
return false;
}
if (!hasBitFlag(getClanData(clanIndex).discordWebhookFlags, requiredFlagValue)) {
return false;
}
messageString = removeColoursInMessage(messageString);
triggerClanDiscordWebHook(clanIndex, messageString);
}
// ===========================================================================
function triggerDiscordWebHook(messageString, serverId = getServerId(), type = AGRP_DISCORD_WEBHOOK_LOG) {
if (!getGlobalConfig().discord.webhook.enabled) {
return false;
@@ -177,4 +200,32 @@ function triggerDiscordWebHook(messageString, serverId = getServerId(), type = A
);
}
// ===========================================================================
function triggerClanDiscordWebHook(clanIndex, messageString) {
if (!getGlobalConfig().discord.webhook.enabled) {
return false;
}
/*
let webhookURL = getClanData(clanIndex).discordWebhookURL;
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) {
}
);
*/
}
// ===========================================================================

View File

@@ -1139,8 +1139,7 @@ function getStaffFlagsCommand(command, params, client) {
return false;
}
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
let flagName = getParam(params, " ", 2) || "None";
let targetClient = getParam(params, " ", 1);
if (!targetClient) {
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));