userGet User

Getting the user in the command section is done by adding .addUserOption in the slash command part.

.addUserOption(options => options
   .setName('user')
   .setDescription('The user whose profile you want to view')
   .setRequired(true)
  ),

It is very important that the option for the user is named 'user,' and then you can use the function from the Utility file.

async execute(moi, args, client, { type, send }) {
   const user = await Utility.getUser(moi, type, args[0]) 
   // args[0]
}

args[0] can be changed to args[1] or another number, depending on the position of the user when typing prefix commands.

Last updated