module shared_utils.discord; void sendDiscordMessage(string webhookUrl, string msg) { import requests; import std.string : strip; import std.stdio; import std.format; string payload = "{\"content\": \"" ~ strip(msg) ~ "\"}"; try { Request rq = Request(); Response resp = rq.post(webhookUrl, 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); } }