Edits history of script submission #79 for ' Send message to channel using webhook (discord)'

  • deno
    import type { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    
    export async function main(
      webhook: Resource<"discord_webhook">,
      content: string,
    ) {
      const req = await fetch(webhook, {
        method: "POST",
        headers: { "Content-type": "application/json" },
        body: JSON.stringify({ content }),
      });
    
      if (req.status != 200) {
        throw Error();
      }
    }
    

    Submitted by admin 1373 days ago