Merge pull request #85 from Dliix66/main

Fixed Discord web hooks with the menu and several bug fixes/improvments on the menus
This commit is contained in:
Dawid Bepierszcz
2024-04-02 18:34:18 +02:00
committed by GitHub
15 changed files with 282 additions and 221 deletions

View File

@@ -223,6 +223,19 @@ namespace CS2_SimpleAdmin
var updatedJsonContent = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true, Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping });
File.WriteAllText(CfgPath, updatedJsonContent);
}
public static void TryLogCommandOnDiscord(CCSPlayerController? caller, string commandString)
{
if (CS2_SimpleAdmin._discordWebhookClientLog == null || CS2_SimpleAdmin._localizer == null)
return;
if (caller != null && caller.IsValid == false)
caller = null;
string callerName = caller == null ? "Console" : caller.PlayerName;
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
CS2_SimpleAdmin._discordWebhookClientLog.SendMessageAsync(GenerateMessageDiscord(CS2_SimpleAdmin._localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", commandString]));
}
}
public class SchemaString<SchemaClass> : NativeObject where SchemaClass : NativeObject