This command allows users with the ADMIN permission to create an embed with a custom title and content. To set up, go to the Slash Command Builder and register the command as "embed" and add 2 required string options. The first one should be title, second one should be content. Use the command like this "/embed YOUR TITLE YOUR CONTENT". Other users will not be able to see who sent it. This snippet was inspired by @theawsome's "Copy Me" snippet but allows more customization and has a command endpoint.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const event = context.params.event;
if (event.member.permission_names.includes('ADMINISTRATOR')) {
let title = event.data.options[0].value;
let content = event.data.options[1].value;
await lib.discord.channels['@0.1.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embed: {
type: 'rich',
title: `${title}`,
description: `${content}`,
color: 131644,
},
});
} else {
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `**<@${context.params.event.member.user.id}> - You need the ADMINISTRATOR permission to use the Embed command!**`,
});
}
//You can add *Sent By:* **<@${context.params.event.member.user.id}>** after the content in the embed description if you want to know who sent it