Send a text message to a channel given a webhook and a channel ID
1
import type { Resource } from "https://deno.land/x/windmill@v1.27.2/mod.ts";
2
3
export async function main(
4
webhook: Resource<"discord_webhook">,
5
content: string,
6
) {
7
const req = await fetch(webhook, {
8
method: "POST",
9
headers: { "Content-type": "application/json" },
10
body: JSON.stringify({ content }),
11
});
12
13
if (req.status != 200) {
14
throw Error();
15
}
16
17