An example of a slash command that only allows administrators to run it. Remember to register your slash command with Discord here: https://autocode.com/tools/discord/command-builder/
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (context.params.event.member.permission_names.includes('ADMINISTRATOR')) {
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Congratulations! You have permission to use this command!`
});
} else {
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Sorry, you need administrator level permissions to use this command.`
});
}