X
X
xpyctofficial2020-08-10 20:07:14
Node.js
xpyctofficial, 2020-08-10 20:07:14

A bug in the warn command where the code does not write a message. What to do?

The error looks like this:
5f317eacc374a755587195.png
Code that has this error:

let member = message.guild.member(message.mentions.users.first()
    || message.guild.members.get(args[0])
    );
    
    if(message.author.roles.position <= member.roles.position) return message.channel.send(${member.username} роль выше, чем у вас!`)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-08-10
@Alexandre888

and you are not confused by the aspect that it message.authordoes not have an attribute roles, especially position?
+ you haven't defined which role to check for the position
, and in general, why do you define the position of the user's role if it is the same for all users?
if you want to check the position of a certain role, just like this:

let role = message.guild.roles.cache.find("name", "название_роли") // нашли роль
message.channel.send(role.position) // отправили в чат её позицию

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question