DiscordEmbed.PostWithSecret
Skip to content
mnscript
StringResult DiscordEmbed.PostWithSecret(Secret) 

Description ​

Posts the embed to the Discord bot using a Secret.

Arguments ​

Secret - The Secret containing the discord Webhook.

Returns ​

StringResult

Example ​

msc
using System;
using Discord;
using Secret;
// You need to make sure the secret is set beforehand with 'secrets add discord-webhook <YOUR_KEY_HERE>'
// Your webhook shoud look something like "32094820394823489/5ASKdaxdfjk2bLKLDjlaj3sdlJDAS3dDjsadas43KJHLSAddDnkjASDkhlgijods243LVOwqQdjsakdkAFHkjfh78AJmL"
Secret secret = Secrets.GetSecret("discord-webhook");

// Creates a DiscordEmbed, adds some fields and posts it to your webhook
DiscordEmbed embed = new DiscordEmbed();
embed.SetTitle("My Webhook");
embed.AddField("First Field", "First Content", true);
embed.AddField("Second Field", "Second Content", true);
embed.AddField("Last Field", "Last Content", false);
embed.PostWithSecrets(secret);