allow override of username in posting

This commit is contained in:
Florian Stinglmayr 2024-09-17 18:57:38 +02:00
parent e617c3852b
commit fd3e5f61cb

View File

@ -9,10 +9,10 @@ namespace EliteBGS;
public class DiscordPoster { public class DiscordPoster {
public static readonly int DiscordLimit = 2000; public static readonly int DiscordLimit = 2000;
public static void PostToDiscord(DiscordWebhook webhook, string log) { public static void PostToDiscord(DiscordWebhook webhook, string log, string username = "EDBGS") {
JsonObject obj = new(); JsonObject obj = new();
obj.Add("content", log); obj.Add("content", log);
obj.Add("username", "EDBGS"); obj.Add("username", username);
using (var client = new HttpClient()) { using (var client = new HttpClient()) {
var content = new StringContent(obj.ToString(), Encoding.UTF8, "application/json"); var content = new StringContent(obj.ToString(), Encoding.UTF8, "application/json");