fix: remove repetitive webhook snippet and replace it with helper function

This commit is contained in:
Dollan
2024-03-30 22:50:16 +01:00
parent b2c56d3fa1
commit d8e30e02e9
7 changed files with 41 additions and 205 deletions

View File

@@ -31,11 +31,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Database database = new Database(dbConnectionString);
@@ -158,11 +154,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
@@ -273,11 +265,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
@@ -379,11 +367,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);

View File

@@ -21,11 +21,7 @@ namespace CS2_SimpleAdmin
if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -54,11 +50,7 @@ namespace CS2_SimpleAdmin
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -109,11 +101,7 @@ namespace CS2_SimpleAdmin
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -129,11 +117,7 @@ namespace CS2_SimpleAdmin
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);

View File

@@ -122,11 +122,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
string steamid = command.GetArg(1);
string name = command.GetArg(2);
@@ -171,11 +167,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
string steamid = command.GetArg(1);
bool globalDelete = command.GetArg(2).ToLower().Equals("-g");
@@ -285,11 +277,7 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
if (command.ArgCount >= 2 && command.GetArg(2).Length > 0)
reason = command.GetArg(2);
@@ -614,11 +598,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -637,11 +617,7 @@ namespace CS2_SimpleAdmin
{
string callerName = caller == null ? "Console" : caller.PlayerName;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);

View File

@@ -32,11 +32,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
int.TryParse(command.GetArg(2), out time);
@@ -157,11 +153,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
@@ -269,11 +261,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -387,11 +375,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
int.TryParse(command.GetArg(2), out time);
@@ -505,11 +489,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -612,11 +592,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -716,11 +692,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
int.TryParse(command.GetArg(2), out time);
@@ -842,11 +814,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -951,11 +919,7 @@ namespace CS2_SimpleAdmin
return;
}
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);

View File

@@ -20,11 +20,7 @@ namespace CS2_SimpleAdmin
if (command.GetArg(1) == null || command.GetArg(1).Length < 0 || command.ArgCount < 2)
return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);

View File

@@ -21,11 +21,7 @@ namespace CS2_SimpleAdmin
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();
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player =>
{
@@ -68,11 +64,7 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player =>
{
@@ -121,11 +113,7 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player =>
{

View File

@@ -23,11 +23,7 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player =>
{
@@ -156,11 +148,7 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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);
if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
@@ -691,11 +647,7 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player =>
{
@@ -754,11 +706,7 @@ namespace CS2_SimpleAdmin
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
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();
if (_discordWebhookClientLog != null && _localizer != null)
{
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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);