//native
type DiscordWebhook = {
webhook_url: string;
};
export async function main(discord_webhook: DiscordWebhook, message: string) {
const response = await fetch(`${discord_webhook.webhook_url}?wait=true`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ content: message }),
});
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`);
}
return await response.json();
}
Submitted by hugo989 4 days ago