mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-18 10:43:23 +00:00
fix: remove repetitive webhook snippet and replace it with helper function
This commit is contained in:
@@ -31,11 +31,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Database database = new Database(dbConnectionString);
|
Database database = new Database(dbConnectionString);
|
||||||
|
|
||||||
@@ -158,11 +154,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||||
|
|
||||||
@@ -273,11 +265,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||||
|
|
||||||
@@ -379,11 +367,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,7 @@ namespace CS2_SimpleAdmin
|
|||||||
if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return;
|
if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return;
|
||||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -54,11 +50,7 @@ namespace CS2_SimpleAdmin
|
|||||||
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
||||||
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -109,11 +101,7 @@ namespace CS2_SimpleAdmin
|
|||||||
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
||||||
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -129,11 +117,7 @@ namespace CS2_SimpleAdmin
|
|||||||
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
||||||
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
|
|||||||
@@ -122,11 +122,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
string steamid = command.GetArg(1);
|
string steamid = command.GetArg(1);
|
||||||
string name = command.GetArg(2);
|
string name = command.GetArg(2);
|
||||||
@@ -171,11 +167,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
string steamid = command.GetArg(1);
|
string steamid = command.GetArg(1);
|
||||||
bool globalDelete = command.GetArg(2).ToLower().Equals("-g");
|
bool globalDelete = command.GetArg(2).ToLower().Equals("-g");
|
||||||
@@ -285,11 +277,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -397,11 +385,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (command.ArgCount >= 2 && command.GetArg(2).Length > 0)
|
if (command.ArgCount >= 2 && command.GetArg(2).Length > 0)
|
||||||
reason = command.GetArg(2);
|
reason = command.GetArg(2);
|
||||||
@@ -614,11 +598,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -637,11 +617,7 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
int.TryParse(command.GetArg(2), out time);
|
int.TryParse(command.GetArg(2), out time);
|
||||||
|
|
||||||
@@ -157,11 +153,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
int time = 0;
|
int time = 0;
|
||||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||||
@@ -269,11 +261,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -387,11 +375,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
int.TryParse(command.GetArg(2), out time);
|
int.TryParse(command.GetArg(2), out time);
|
||||||
|
|
||||||
@@ -505,11 +489,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -612,11 +592,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -716,11 +692,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
int.TryParse(command.GetArg(2), out time);
|
int.TryParse(command.GetArg(2), out time);
|
||||||
|
|
||||||
@@ -842,11 +814,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -951,11 +919,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,7 @@ namespace CS2_SimpleAdmin
|
|||||||
if (command.GetArg(1) == null || command.GetArg(1).Length < 0 || command.ArgCount < 2)
|
if (command.GetArg(1) == null || command.GetArg(1).Length < 0 || command.ArgCount < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
@@ -68,11 +64,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
@@ -121,11 +113,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,11 +23,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -98,11 +94,7 @@ namespace CS2_SimpleAdmin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
@@ -156,11 +148,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -210,11 +198,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -264,11 +248,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -318,11 +298,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -372,11 +348,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -423,11 +395,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -486,11 +454,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -545,11 +509,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
if (targets == null) return;
|
if (targets == null) return;
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
@@ -647,11 +607,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -691,11 +647,7 @@ namespace CS2_SimpleAdmin
|
|||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
@@ -754,11 +706,7 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|
||||||
@@ -810,11 +758,7 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||||
{
|
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Helper.LogCommand(caller, command);
|
Helper.LogCommand(caller, command);
|
||||||
|
|||||||
Reference in New Issue
Block a user