Ask coding questions

← Back to all posts
My nickname command is not working.
EvanDowding (0)

Today, I was working on a custom discord command for my bot that changes a user's nickname to my choosing. How it is supposed to work is: -nick @user (nickname). Obviously it did not work, otherwise, I would not be here. here is my code:

module.exports = class NicknameCommand extends Commando.Command {
  constructor(client) {
    super (client, {
      name: 'nick',
      group: 'commands'
      memberName: 'nick', 
      userPermissions: [
        'MANAGE_NICKNAMES',
        'CHANGE_NICKNAME'
      ],
      clientPermissions: [
        'MANAGE_NICKNAMES',
        'CHANGE_NICKNAME'
      ],
      description: 'Changes the nickname of the user'
      argsType: 'multiple'
    })
  }
}

run = (message, args) => {
  const target = message.mentions.users.first()
  const member = message.guild.members.cache.get(target.id)

    args.shift()
    const nickname = args.join(' ')

    member.setNickname(nickname)

    message.reply('You changed the nickname!')
  }
}```
Comments
hotnewtop
EvanDowding (0)

And yes, that is a old token. If you try to use it, it will be invalid.