module shared_utils.discord; void sendDiscordMessage(string msg) { import requests; import std.string : strip; import std.stdio; import std.format; const string WEBHOOK_URL = "https://discord.com/api/webhooks/1242607102011244645/fIBfGz3_Xp_C0EQTymXhcUW6kfde45mo01wvvJ9RerFfItTPX23eu5QUAdulaJBwaQrK"; string payload = "{\"content\": \"" ~ strip(msg) ~ "\"}"; try { Request rq = Request(); Response resp = rq.post(WEBHOOK_URL, payload, "application/json"); if (resp.code >= 300) { writeln(resp.code); writeln(resp.responseBody); throw new Exception(format!"Discord message failed with code %d: %s"(resp.code, resp.responseBody)); } } catch (Exception e) { stderr.writefln("Failed to send discord webhook message: ", e); } }