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

  • bun
    import discordwebhook from "https://deno.land/x/discordwebhook/mod.ts";
    
    type DiscordWebhook = {
      webhook_url: string;
    };
    
    export async function main(discord_webhook: DiscordWebhook, message: string) {
      // Normalize legacy Discord webhook URLs to the current domain
      const normalized_url = discord_webhook.webhook_url.replace("discordapp.com", "discord.com");
    
      const webhook = new discordwebhook(normalized_url);
      const ret = await webhook.createMessage(message);
      return ret;
    }
    

    Submitted by joshuarussell.online513 327 days ago