Small changes

- Correct version
- null warnings
This commit is contained in:
Dawid Bepierszcz
2024-01-31 23:57:14 +01:00
parent 66f0ebe08c
commit 9acab82f86

View File

@@ -8,6 +8,7 @@ using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Cvars;
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Menu;
using CounterStrikeSharp.API.Modules.Utils;
using Microsoft.Extensions.Localization;
@@ -15,15 +16,12 @@ using Microsoft.Extensions.Logging;
using MySqlConnector;
using System.Collections.Concurrent;
using System.Text;
using CS2_SimpleAdmin.Menus;
namespace CS2_SimpleAdmin;
[MinimumApiVersion(159)]
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
{
public static CS2_SimpleAdmin Instance { get; private set; } = null;
public static IStringLocalizer? _localizer;
public static ConcurrentBag<string> gaggedPlayers = new ConcurrentBag<string>();
//public static ConcurrentBag<int> mutedPlayers = new ConcurrentBag<int>();
@@ -39,20 +37,22 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin";
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy";
public override string ModuleVersion => "1.3.0";
public override string ModuleVersion => "1.2.9a";
private MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>? CBasePlayerController_SetPawnFunc;
public CS2_SimpleAdminConfig Config { get; set; } = new();
public override void Load(bool hotReload)
{
Instance = this;
registerEvents();
if (hotReload)
{
OnMapStart(string.Empty);
}
CBasePlayerController_SetPawnFunc = new MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>(@"\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x41\x54\x49\x89\xFC\x53\x48\x89\xF3\x48\x81\xEC\xC8\x00\x00\x00");
}
public void OnConfigParsed(CS2_SimpleAdminConfig config)
@@ -157,9 +157,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
_localizer = Localizer;
}
[ConsoleCommand("css_adminhelp")]
[ConsoleCommand("css_admin")]
[RequiresPermissions("@css/generic")]
public void OnAdminHelpCommand(CCSPlayerController? caller, CommandInfo command)
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null || !caller.IsValid) return;
@@ -171,16 +171,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
}
}
[ConsoleCommand("css_admin")]
[RequiresPermissions("@css/generic")]
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null || caller.IsValid == false)
return;
AdminMenu.OpenMenu(caller);
}
[ConsoleCommand("css_addadmin")]
[CommandHelper(minArgs: 4, usage: "<steamid> <name> <flags/groups> <immunity> <duration>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
[RequiresPermissions("@css/root")]
@@ -275,37 +265,42 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
command.ReplyToCommand("Reloaded sql admins");
}
[ConsoleCommand("css_silentmode")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
[ConsoleCommand("css_stealth")]
[ConsoleCommand("css_hide")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
[RequiresPermissions("@css/kick")]
public void OnSilentModeCommand(CCSPlayerController? caller, CommandInfo command)
public void OnHideCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null || caller.UserId == null) return;
if (silentPlayers.Contains((ushort)caller.UserId))
{
silentPlayers.Remove((ushort)caller.UserId);
command.ReplyToCommand("SilentMode Deactivated");
caller.ChangeTeam(CsTeam.Spectator);
caller.PrintToChat($"You aren't hidden now!");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"{caller.PlayerName} isn't hidden now.");
}
else
{
silentPlayers.Add((ushort)caller.UserId);
command.ReplyToCommand("SilentMode Activated");
}
}
[ConsoleCommand("css_hide")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
[RequiresPermissions("@css/kick")]
public void OnHideCommand(CCSPlayerController? caller, CommandInfo command)
Server.ExecuteCommand("sv_disable_teamselect_menu 1");
Server.NextFrame(() =>
{
if (caller == null) return;
if (caller.PlayerPawn.Value != null && caller.PawnIsAlive)
caller.PlayerPawn.Value.CommitSuicide(true, false);
caller.PlayerPawn.Value!.CommitSuicide(true, false);
caller.ChangeTeam(CsTeam.Spectator);
AddTimer(1.0f, () => { caller.ChangeTeam(CsTeam.None); });
command.ReplyToCommand("You are hidden now");
AddTimer(1.0f, () => { caller.ChangeTeam(CsTeam.Spectator); });
AddTimer(1.1f, () => { caller.ChangeTeam(CsTeam.None); });
caller.PrintToChat($"You are hidden now!");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"{caller.PlayerName} is hidden now.");
});
Server.NextFrame(() =>
{
AddTimer(1.25f, () => { Server.ExecuteCommand("sv_disable_teamselect_menu 0"); });
});
}
}
[ConsoleCommand("css_who")]
@@ -317,23 +312,13 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
if (targets == null) return;
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => caller!.CanTarget(player) && player != null && player.IsValid && !player.IsBot && !player.IsHLTV).ToList();
BanManager banManager = new(dbConnectionString, Config);
MuteManager muteManager = new(dbConnectionString);
BanManager _banManager = new(dbConnectionString, Config);
MuteManager _muteManager = new(dbConnectionString);
playersToTarget.ForEach(player =>
{
if (caller!.CanTarget(player))
{
Who(caller, player, banManager, muteManager);
}
});
}
public void Who(CCSPlayerController? caller, CCSPlayerController player, BanManager banManager = null, MuteManager muteManager = null)
{
banManager ??= new(dbConnectionString, Config);
muteManager ??= new(dbConnectionString);
PlayerInfo playerInfo = new PlayerInfo
{
UserId = player.UserId,
@@ -348,37 +333,64 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
int totalBans = 0;
int totalMutes = 0;
totalBans = await banManager.GetPlayerBans(playerInfo);
totalMutes = await muteManager.GetPlayerMutes(playerInfo.SteamId!);
totalBans = await _banManager.GetPlayerBans(playerInfo);
totalMutes = await _muteManager.GetPlayerMutes(playerInfo.SteamId!);
Server.NextFrame(() =>
{
Action<string> printMethod = caller == null ? Server.PrintToConsole : caller.PrintToConsole;
printMethod($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
if (caller != null)
{
caller!.PrintToConsole($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
printMethod($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
printMethod($"• UserID: \"{playerInfo.UserId}\"");
caller!.PrintToConsole($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
caller!.PrintToConsole($"• UserID: \"{playerInfo.UserId}\"");
if (playerInfo.SteamId != null)
printMethod($"• SteamID64: \"{playerInfo.SteamId}\"");
caller!.PrintToConsole($"• SteamID64: \"{playerInfo.SteamId}\"");
if (player.AuthorizedSteamID != null)
{
printMethod($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
printMethod($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
caller!.PrintToConsole($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
caller!.PrintToConsole($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
}
if (playerInfo.IpAddress != null)
printMethod($"• IP Address: \"{playerInfo.IpAddress}\"");
printMethod($"• Ping: \"{player.Ping}\"");
caller!.PrintToConsole($"• IP Address: \"{playerInfo.IpAddress}\"");
caller!.PrintToConsole($"• Ping: \"{player.Ping}\"");
if (player.AuthorizedSteamID != null)
{
printMethod($"• Total Bans: \"{totalBans}\"");
printMethod($"• Total Mutes: \"{totalMutes}\"");
caller!.PrintToConsole($"• Total Bans: \"{totalBans}\"");
caller!.PrintToConsole($"• Total Mutes: \"{totalMutes}\"");
}
printMethod($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
caller!.PrintToConsole($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
}
else
{
Server.PrintToConsole($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
Server.PrintToConsole($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
Server.PrintToConsole($"• UserID: \"{playerInfo.UserId}\"");
if (playerInfo.SteamId != null)
Server.PrintToConsole($"• SteamID64: \"{playerInfo.SteamId}\"");
if (player.AuthorizedSteamID != null)
{
Server.PrintToConsole($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
Server.PrintToConsole($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
}
if (playerInfo.IpAddress != null)
Server.PrintToConsole($"• IP Address: \"{playerInfo.IpAddress}\"");
Server.PrintToConsole($"• Ping: \"{player.Ping}\"");
if (player.AuthorizedSteamID != null)
{
Server.PrintToConsole($"• Total Bans: \"{totalBans}\"");
Server.PrintToConsole($"• Total Mutes: \"{totalMutes}\"");
}
Server.PrintToConsole($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
}
});
});
}
});
}
[ConsoleCommand("css_players")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
@@ -414,7 +426,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name> [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnKickCommand(CCSPlayerController? caller, CommandInfo command)
{
string reason = null;
string reason = "Unknown";
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@@ -431,13 +443,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
targets.Players.ForEach(player =>
{
if (caller!.CanTarget(player))
{
Kick(caller, player, reason);
}
});
}
public void Kick(CCSPlayerController? caller, CCSPlayerController player, string reason = null)
{
if (player.PawnIsAlive)
{
@@ -445,7 +450,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
player.CommitSuicide(true, true);
}
if (string.IsNullOrEmpty(reason) == false)
if (command.ArgCount >= 2)
{
player.PrintToCenter(_localizer!["sa_player_kick_message", reason, caller == null ? "Console" : caller.PlayerName]);
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player.UserId!, reason));
@@ -461,6 +466,14 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
sb.Append(_localizer["sa_admin_kick_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
}
if (Config.DiscordWebhook.Length > 0 && _localizer != null)
{
LocalizedString localizedMessage = _localizer["sa_admin_kick_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
[ConsoleCommand("css_gag")]
@@ -469,7 +482,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public void OnGagCommand(CCSPlayerController? caller, CommandInfo command)
{
int time = 0;
string reason = null;
string reason = "Unknown";
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@@ -491,16 +504,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Gag(caller, player, time, reason, _muteManager);
}
});
}
public void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason = null, MuteManager muteManager = null)
{
reason ??= "Unknown";
muteManager ??= new(dbConnectionString);
PlayerInfo playerInfo = new PlayerInfo
{
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
@@ -517,7 +520,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
Task.Run(async () =>
{
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
await _muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
});
if (TagsDetected)
@@ -557,6 +560,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_gag_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -568,9 +576,16 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_gag_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
});
}
[ConsoleCommand("css_addgag")]
[RequiresPermissions("@css/chat")]
@@ -627,6 +642,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_gag_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -638,6 +658,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_gag_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
@@ -773,6 +798,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
});
command.ReplyToCommand($"Ungaged player with pattern {pattern}.");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"Ungaged player with pattern {pattern}.");
return;
}
}
@@ -783,7 +810,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public void OnMuteCommand(CCSPlayerController? caller, CommandInfo command)
{
int time = 0;
string reason = null;
string reason = "Unknown";
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@@ -805,16 +832,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Mute(caller, player, time, reason, _muteManager);
}
});
}
public void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason = null, MuteManager muteManager = null)
{
reason ??= "Unknown";
muteManager ??= new(dbConnectionString);
PlayerInfo playerInfo = new PlayerInfo
{
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
@@ -836,15 +853,17 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
player!.VoiceFlags = VoiceFlags.Muted;
Task.Run(async () => { await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 1); });
Task.Run(async () =>
{
await _muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 1);
});
if (time > 0 && time <= 30)
{
AddTimer(time * 60, () =>
{
if (player == null || !player.IsValid || player.AuthorizedSteamID == null)
return;
if (player == null || !player.IsValid || player.AuthorizedSteamID == null) return;
//MuteManager _muteManager = new(dbConnectionString);
//_ = _muteManager.UnmutePlayer(player.AuthorizedSteamID.SteamId64.ToString(), 1);
@@ -872,6 +891,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_mute_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -883,9 +907,16 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_mute_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
});
}
[ConsoleCommand("css_addmute")]
[RequiresPermissions("@css/chat")]
@@ -942,6 +973,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_mute_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -953,6 +989,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_mute_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
@@ -1087,6 +1128,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
});
command.ReplyToCommand($"Unmuted player with pattern {pattern}.");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"Unmuted player with pattern {pattern}.");
return;
}
}
@@ -1122,16 +1165,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Ban(caller, player, time, reason, _banManager);
}
});
}
public void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason = null, BanManager banManager = null)
{
reason ??= "Unknown";
banManager ??= new(dbConnectionString, Config);
if (player.PawnIsAlive)
{
player.Pawn.Value!.Freeze();
@@ -1154,7 +1187,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
Task.Run(async () =>
{
await banManager.BanPlayer(playerInfo, adminInfo, reason, time);
await _banManager.BanPlayer(playerInfo, adminInfo, reason, time);
});
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player!.UserId!));
@@ -1168,6 +1201,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -1179,9 +1217,16 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
});
}
[ConsoleCommand("css_addban")]
[RequiresPermissions("@css/ban")]
@@ -1241,6 +1286,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -1252,6 +1302,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
@@ -1321,6 +1376,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -1332,6 +1392,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
@@ -1365,6 +1430,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
_ = _banManager.UnbanPlayer(pattern);
command.ReplyToCommand($"Unbanned player with pattern {pattern}.");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"Unbanned player with pattern {pattern}.");
}
[ConsoleCommand("css_slay")]
@@ -1377,12 +1444,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => caller!.CanTarget(player) && player != null && player.IsValid && player.PawnIsAlive).ToList();
playersToTarget.ForEach(player =>
{
Slay(caller, player);
});
}
public void Slay(CCSPlayerController? caller, CCSPlayerController player)
{
player.CommitSuicide(false, true);
@@ -1391,8 +1452,14 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_slay_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_slay_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
[ConsoleCommand("css_give")]
[RequiresPermissions("@css/cheats")]
@@ -1438,6 +1505,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_give_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, weaponName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_give_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, weaponName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
@@ -1463,6 +1535,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
sb.Append(_localizer["sa_admin_strip_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_strip_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -1492,6 +1569,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
sb.Append(_localizer["sa_admin_hp_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_hp_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -1525,6 +1607,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
sb.Append(_localizer["sa_admin_speed_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_speed_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -1556,6 +1643,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
sb.Append(_localizer["sa_admin_god_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_god_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
@@ -1582,22 +1674,22 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Slap(caller, player, damage);
}
});
}
public void Slap(CCSPlayerController? caller, CCSPlayerController player, int damage)
{
player.Pawn.Value!.Slap(damage);
player!.Pawn.Value!.Slap(damage);
StringBuilder sb = new(_localizer!["sa_prefix"]);
if (caller == null || caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
{
sb.Append(_localizer["sa_admin_slap_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_slap_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
}
[ConsoleCommand("css_team")]
[RequiresPermissions("@css/kick")]
@@ -1637,19 +1729,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
break;
}
bool kill = command.GetArg(3)?.ToLower().Equals("-k") ?? false;
playersToTarget.ForEach(player =>
{
ChangeTeam(caller, player, _teamName, teamNum, kill);
});
}
public void ChangeTeam(CCSPlayerController? caller, CCSPlayerController player, string teamName, CsTeam teamNum, bool kill)
{
if (!teamName.Equals("swap"))
{
if (player.PawnIsAlive && teamNum != CsTeam.Spectator && !kill)
if (player.PawnIsAlive && teamNum != CsTeam.Spectator && !command.GetArg(3).ToLower().Equals("-k"))
player.SwitchTeam(teamNum);
else
player.ChangeTeam(teamNum);
@@ -1658,9 +1742,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (player.TeamNum != (byte)CsTeam.Spectator)
{
teamNum = (CsTeam)player.TeamNum == CsTeam.Terrorist ? CsTeam.CounterTerrorist : CsTeam.Terrorist;
teamName = teamNum == CsTeam.Terrorist ? "TT" : "CT";
if (player.PawnIsAlive && !kill)
CsTeam teamNum = (CsTeam)player.TeamNum == CsTeam.Terrorist ? CsTeam.CounterTerrorist : CsTeam.Terrorist;
_teamName = teamNum == CsTeam.Terrorist ? "TT" : "CT";
if (player.PawnIsAlive && !command.GetArg(3).ToLower().Equals("-k"))
{
player.SwitchTeam(teamNum);
}
@@ -1674,10 +1758,16 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_team_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, teamName]);
sb.Append(_localizer["sa_admin_team_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, _teamName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_team_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, _teamName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
[ConsoleCommand("css_vote")]
[RequiresPermissions("@css/generic")]
@@ -1706,6 +1796,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
voteInProgress = true;
@@ -1721,12 +1816,22 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_vote_message_results", question]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_vote_message_results", question];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
foreach (KeyValuePair<string, int> kvp in voteAnswers)
{
sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_vote_message_results_answer", kvp.Key, kvp.Value]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_vote_message_results_answer", kvp.Key, kvp.Value];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
voteAnswers.Clear();
voteInProgress = false;
@@ -1772,6 +1877,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
if (!map.StartsWith("ws:"))
@@ -1807,6 +1917,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
AddTimer(2.0f, () =>
@@ -1827,6 +1942,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new();
sb.Append(_localizer!["sa_adminchat_template_admin", caller == null ? "Console" : caller.PlayerName, utf8String]);
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_adminchat_template_admin", caller == null ? "Console" : caller.PlayerName, utf8String];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
foreach (var p in Utilities.GetPlayers().Where(p => p.IsValid && !p.IsBot && !p.IsHLTV && AdminManager.PlayerHasPermissions(p, "@css/chat")))
{
@@ -1847,6 +1967,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new();
sb.Append(_localizer!["sa_adminsay_prefix", utf8String]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_adminsay_prefix", utf8String];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
[ConsoleCommand("css_psay", "Private message a player.")]
@@ -1867,6 +1992,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
playersToTarget.ForEach(player =>
{
player.PrintToChat(Helper.ReplaceTags($"({caller!.PlayerName}) {utf8String}"));
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"PSAY: {caller!.PlayerName} --> {player!.PlayerName}: {utf8String}");
});
command.ReplyToCommand(Helper.ReplaceTags($" Private message sent!"));
@@ -1881,6 +2008,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
Helper.PrintToCenterAll(Helper.ReplaceTags(utf8String));
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"CSAY: {caller!.PlayerName}: {utf8String}");
}
[ConsoleCommand("css_hsay", "Say to all players (in hud).")]
@@ -1895,6 +2024,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
HudDestination.Alert,
Helper.ReplaceTags(utf8String),
0, 0, 0, 0);
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"HSAY: {caller!.PlayerName}: {utf8String}");
}
[ConsoleCommand("css_noclip", "Noclip a player.")]
@@ -1916,6 +2048,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_noclip_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_noclip_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -1946,6 +2083,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_freeze_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_freeze_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -1968,6 +2110,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_unfreeze_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_unfreeze_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
@@ -1984,7 +2131,12 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
player!.Respawn();
if (CBasePlayerController_SetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return;
var playerPawn = player.PlayerPawn.Value;
CBasePlayerController_SetPawnFunc.Invoke(player, playerPawn, true, false);
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
{
@@ -1992,6 +2144,12 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
sb.Append(_localizer["sa_admin_respawn_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
}
if (Config.DiscordWebhook.Length > 0 && _localizer != null)
{
LocalizedString localizedMessage = _localizer["sa_admin_respawn_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
@@ -2022,6 +2180,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
command.ReplyToCommand($"{playerName} changed cvar {cvar.Name} to {value}.");
Logger.LogInformation($"{playerName} changed cvar {cvar.Name} to {value}.");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"{playerName} changed cvar {cvar.Name} to {value}.");
}
[ConsoleCommand("css_rcon", "Run a server console command.")]
@@ -2033,6 +2193,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
Server.ExecuteCommand(command.ArgString);
command.ReplyToCommand($"{playerName} executed command {command.ArgString}.");
Logger.LogInformation($"{playerName} executed command ({command.ArgString}).");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"{playerName} executed command ({command.ArgString}).");
}
private static TargetResult? GetTarget(CommandInfo command)
@@ -2053,22 +2215,21 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
command.ReplyToCommand($"Multiple targets found for \"{command.GetArg(1)}\".");
return null;
}
/*
var matches = Helper.GetTarget(command.GetArg(1), out player);
switch (matches)
public async Task SendWebhookMessage(string message)
{
case TargetResult.None:
command.ReplyToCommand($"Target {command.GetArg(1)} not found.");
return false;
using (var httpClient = new HttpClient())
{
var payload = new
{
content = message
};
case TargetResult.Multiple:
command.ReplyToCommand($"Multiple targets found for \"{command.GetArg(1)}\".");
return false;
}
var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload);
var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
return true;
*/
var response = await httpClient.PostAsync(Config.DiscordWebhook, content);
}
}
}