N
N
Nelsonsink2020-05-06 13:38:53
JavaScript
Nelsonsink, 2020-05-06 13:38:53

How to make the command / setnick (person id) (new nickname)?

Good afternoon. I can't issue a command to set a nickname. The examples are wrong, please help. DJS Version - 11

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-05-06
@NeiroNx

After reading the documentation , you can write the following:

client.on('message', message => {
  if (!message.content.startsWith(prefix) || message.author.bot) return;

  const args = message.content.slice(prefix.length).split(/ +/);
  const command = args.shift().toLowerCase();

  if (command === 'setnick') {
    for(user in message.channel.members)if(user.id == args[0])user.setNickname(args[1]);
  }
  // other commands...
});

perhaps because of the wrong types it will not work, but the main thing is to find the user and set a nickname for him.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question