After setting up the package you're ready to create the first slash command
// Create the commandconstcmd=newutils.Command({ name:"welcome",// 1-32 lowercase character name matching ^[\w-]{1,32}$ description:"The first interaction using disc-utils",// 1-100 character description default_permission:true// whether the command is enabled by default when the app is added to a guild})// Create an optionconstfeeling=newutils.Option({ name:"feeling",// 1-32 lowercase character name matching ^[\w-]{1,32}$ description:"How do you feel today",// 1-100 character description type:"string"// the type of the value})// Create choices for the optionfeeling.setChoices([newutils.Choice({ name:"Good",// 1-100 character choice name value:"good"// value of the choice, up to 100 characters if string }),newutils.Choice({ name:"It's okay", value:"okay" }),newutils.Choice({ name:"Not good", value:"bad" })])// To test the ephemeral messages, we add another optionconstephemeral=newutils.Option({ name:"ephemeral", description:"Set the response to an ephemeral message", type:"boolean"})// Now we need to add the choices to the commandcmd.setOptions([ feeling, ephemeral])// Now we need to register the commandconsole.log(awaitutils.global().createCommand(cmd))/** * Discord is caching all global slash commands for 1 hour but to test the slash command immediately you need create a guild command:
* * utils.guild("guild id").createCommand(cmd) */
And here we go. You are getting the command logged, that Discord returns