PenaltyWebhook block thread - fix

This commit is contained in:
Dawid Bepierszcz
2024-08-13 21:14:43 +02:00
parent f95581e7c0
commit 79270acafe

View File

@@ -245,7 +245,7 @@ namespace CS2_SimpleAdmin
var communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl() + ">" : "<https://steamcommunity.com/profiles/0>"; var communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl() + ">" : "<https://steamcommunity.com/profiles/0>";
var callerName = caller != null ? caller.PlayerName : "Console"; var callerName = caller != null ? caller.PlayerName : "Console";
discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command])); discordWebhookClientLog.SendMessageAsync(GenerateMessageDiscord(localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command]));
} }
public enum PenaltyType public enum PenaltyType
@@ -339,7 +339,10 @@ namespace CS2_SimpleAdmin
embed.AddField(fieldNames[i], fieldValues[i], inlineFlags[i]); embed.AddField(fieldNames[i], fieldValues[i], inlineFlags[i]);
} }
new DiscordWebhookClient(webhookUrl).SendMessageAsync(embeds: [embed.Build()]); Task.Run(async () =>
{
await new DiscordWebhookClient(webhookUrl).SendMessageAsync(embeds: [embed.Build()]);
});
} }
private static string GenerateMessageDiscord(string message) private static string GenerateMessageDiscord(string message)