Discord: Without livechat, and updated urls

This commit is contained in:
zaCade 2019-03-16 23:29:27 +01:00
parent 1b96a060e8
commit 24f351dc11

View File

@ -5,7 +5,7 @@
#include <SteamWorks>
#include <regex>
#include <smjansson>
#include <morecolors>
#include <multicolors>
#include "sdktools_functions.inc"
@ -16,30 +16,29 @@
#pragma newdecls required
#define STEAM_API_KEY "7FF6DCA2152A102DFF8CEC89D917B2B2"
#define DISCORD_LIVEWEBHOOK_URL "https://discordapp.com/api/webhooks/420234463335677961/HC5Sd_WJu4fGq1SlwOfvHLPcpCMoNAniITYAbxz2gAT80VAFin8TWK8P9x0xQSJgLXRj"
#define DISCORD_LIVEWEBHOOK_URL ""
#define DISCORD_ADMINLOGS_WEBHOOKURL "https://discordapp.com/api/webhooks/420234772254687233/pgqnmLXwR8bTe5SI_EHU5ZbbyITQxBB5FsiyyDzvhQS5LZLsyljzfFGDPpY55aH5H-Lp"
#define DISCORD_ADMINCHAT_WEBHOOKURL "https://discordapp.com/api/webhooks/420234615173939220/4k2ejMnksUxS_Fv0UtTazdoWfOVizxli4Bz97PHhw4vgPkkOuG_nNuFNpmsfxCs6XFbm"
#define DISCORD_ADMINCHAT_WEBHOOKURL "https://discordapp.com/api/webhooks/554631582183587841/viMQZB8bQXRtQphtVSd04QTNtPd5PpvClJxunWdySYqM4Jty4xeejqqXGzBzbezycpxF"
#define DISCORD_RCON_WEBHOOKURL "https://discordapp.com/api/webhooks/421078039699521536/WHHvLf4DkY8UUR_C0BjdCk1REbu5jugAzOrr0MU2nvrhR0hxn6OtlHhHgi-dR7VmfEaT"
#define DISCORD_CALLADMIN_WEBHOOKURL "https://discordapp.com/api/webhooks/423998266544357376/1LeQ5yxlsrAvi8MfgmE1HaI_IHDn419lXefwIS6WveyTa3dbZbPhNOs5cDnc8dLATeNv"
#define DISCORD_ANTIBHOPCHEAT_WEBHOOKURL "https://discordapp.com/api/webhooks/424725421632782353/76taTm6PgfeT02oX_yTgM-WEESAFp5uWxwZCoFnrW23cX8hxg9l-9mZTbCz-uI579n_9"
#define DISCORD_ENTWATCH_WEBHOOKURL "https://discordapp.com/api/webhooks/428546704195715072/s18ixMOKzadul8OwuQ3wONb3bcsjh-CIPq3jg-g2Ljhc50JpWiepwUWewJQybavpuaOv"
Regex g_Regex_Clyde = null;
ArrayList g_arrQueuedMessages = null;
Handle g_hDataTimer = null;
Handle g_hReplaceConfigFile = null;
//Handle g_hReplaceConfigFile = null;
UserMsg g_umSayText2 = INVALID_MESSAGE_ID;
bool g_bLoadedLate;
bool g_bProcessingData;
bool g_bGotReplaceFile;
bool g_bTeamChat;
//bool g_bGotReplaceFile;
//bool g_bTeamChat;
char g_sReplacePath[PLATFORM_MAX_PATH];
//char g_sReplacePath[PLATFORM_MAX_PATH];
char g_sAvatarURL[MAXPLAYERS + 1][128];
int g_iRatelimitRemaining = 5;
@ -73,11 +72,11 @@ public void OnPluginStart()
if (RegexErr != REGEX_ERROR_NONE)
LogError("Could not compile \"Clyde\" regex (err: %s)", sRegexErr);
g_hReplaceConfigFile = CreateKeyValues("AutoReplace");
BuildPath(Path_SM, g_sReplacePath, sizeof(g_sReplacePath), "configs/custom-chatcolorsreplace.cfg");
// g_hReplaceConfigFile = CreateKeyValues("AutoReplace");
// BuildPath(Path_SM, g_sReplacePath, sizeof(g_sReplacePath), "configs/custom-chatcolorsreplace.cfg");
if (FileToKeyValues(g_hReplaceConfigFile, g_sReplacePath))
g_bGotReplaceFile = true;
// if (FileToKeyValues(g_hReplaceConfigFile, g_sReplacePath))
// g_bGotReplaceFile = true;
g_arrQueuedMessages = CreateArray(ByteCountToCells(1024));
@ -88,9 +87,8 @@ public void OnPluginStart()
if (g_umSayText2 == INVALID_MESSAGE_ID)
SetFailState("This game doesn't support SayText2 user messages.");
HookUserMessage(g_umSayText2, Hook_UserMessage, false);
HookEvent("player_say", EventHook_PlayerSay, EventHookMode_Post);
// HookUserMessage(g_umSayText2, Hook_UserMessage, false);
// HookEvent("player_say", EventHook_PlayerSay, EventHookMode_Post);
if (g_bLoadedLate)
{
@ -117,8 +115,8 @@ public void OnPluginEnd()
delete g_arrQueuedMessages;
delete g_hDataTimer;
UnhookUserMessage(g_umSayText2, Hook_UserMessage, false);
UnhookEvent("player_say", EventHook_PlayerSay, EventHookMode_Post);
// UnhookUserMessage(g_umSayText2, Hook_UserMessage, false);
// UnhookEvent("player_say", EventHook_PlayerSay, EventHookMode_Post);
}
public void OnClientAuthorized(int client, const char[] sAuthID32)
@ -223,6 +221,7 @@ public Action Timer_DataProcessor(Handle hThis)
return;
}
}
/*
public Action Hook_UserMessage(UserMsg msg_id, Handle bf, const players[], int playersNum, bool reliable, bool init)
{
char sMessageName[32];
@ -251,8 +250,8 @@ public void EventHook_PlayerSay(Event hThis, const char[] sName, bool bDontBroad
{
int iUserID = GetEventInt(hThis, "userid");
int iClient = GetClientOfUserId(iUserID);
char sMessageText[192];
char sMessageText[192];
GetEventString(hThis, "text", sMessageText, sizeof(sMessageText));
//PrintToServer("[EventHook_PlayerSay] Fired for %N: %s", iClient, sMessageText);
@ -263,11 +262,8 @@ public void EventHook_PlayerSay(Event hThis, const char[] sName, bool bDontBroad
return;
char sClientName[64];
GetClientName(iClient, sClientName, sizeof(sClientName));
if (g_bGotReplaceFile)
{
char sPart[192];
@ -321,7 +317,7 @@ public void EventHook_PlayerSay(Event hThis, const char[] sName, bool bDontBroad
else
Discord_POST(DISCORD_LIVEWEBHOOK_URL, sMessageText, true, sClientName);
}
*/
stock bool Steam32IDtoSteam64ID(const char[] sSteam32ID, char[] sSteam64ID, int Size)
{
if (strlen(sSteam32ID) < 11 || strncmp(sSteam32ID[0], "STEAM_0:", 8) || strcmp(sSteam32ID, "STEAM_ID_PENDING") == 0)
@ -365,14 +361,14 @@ stock void Discord_MakeStringSafe(const char[] sOrigin, char[] sOut, int iOutSiz
// {
// strcopy(sOut[iCurIndex], iOutSize, "\\u0022");
// iCurIndex += 6;
//
// continue;
// }
// case '\\':
// {
// strcopy(sOut[iCurIndex], iOutSize, "\\u005C");
// iCurIndex += 6;
//
// continue;
// }
case '@':
@ -831,7 +827,6 @@ public int entWatch_OnClientBanned(int admin, int iLenght, int client)
Format(sMessageTmp, sizeof(sMessageTmp), "%L got restricted by %L for %d minutes", client, admin, iLenght);
}
char sMessage[4096];
Format(sMessage, sizeof(sMessage), "```%s - Tick: %d``````%s```", currentMap, GetGameTickCount(), sMessageTmp);