Guest User

Passing in Options Directly

a guest
Jan 5th, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = {
  2.     data: new SlashCommandBuilder()
  3.         .setName('embedcreator')
  4.         .setDescription('This creates a custom embed')
  5.         // Here we declare all three of our options for the author
  6.         .addStringOption(Option =>
  7.             Option
  8.                 .setName('author-name')
  9.                 .setDescription('This is the name of author of the embed')
  10.                 .setRequired(false)
  11.         )
  12.         .addStringOption(Option =>
  13.             Option
  14.                 .setName('author-icon-url')
  15.                 .setDescription('This is the image URL of author of the embed')
  16.                 .setRequired(false)
  17.         )
  18.         .addStringOption(Option =>
  19.             Option
  20.                 .setName('author-link')
  21.                 .setDescription('This is the clickable link of author of the embed')
  22.                 .setRequired(false)
  23.         )
  24.  
  25.     async execute(interaction) {
  26.         const embed = new EmbedBuilder()
  27.             .setAuthor({
  28.                 // Now we will pass those directly into our embed
  29.                 name: interaction.options.getString('author-name'),
  30.                 iconURL: interaction.options.getString('author-icon-url'),
  31.                 url: interaction.options.getString('author-link')
  32.             })
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment