Discord webhook from menus

This commit is contained in:
Valentin Barat
2024-03-16 16:01:26 +01:00
parent 0f4a2835d2
commit 90c0564f56
7 changed files with 123 additions and 188 deletions

View File

@@ -31,12 +31,6 @@ 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]));
}
Database database = new Database(dbConnectionString);
BanManager _banManager = new(database, Config);
@@ -80,7 +74,9 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0]
};
Helper.LogCommand(caller, $"css_ban {player.SteamID} {time} {reason}");
string commandName = $"css_ban {player.SteamID} {time} {reason}";
Helper.LogCommand(caller, commandName);
Helper.TryLogCommandOnDiscord(caller, commandName);
Task.Run(async () =>
{