T
T
TipoImya2020-08-07 18:46:51
Node.js
TipoImya, 2020-08-07 18:46:51

It is necessary to find some role from the array with roles. How?

I have an array with role names. A person writes a command, after which he mentions a role, if this role is in the array, then we do something further. I do not understand how to do it, and is it possible?

Answer the question

In order to leave comments, you need to log in

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

yes, it is possible.
it will only be easier to do if the user specifies the role id:

if (message.content.startsWith(prefix + "addrole")) {

    var args = message.content.slice(prefix.length).trim().split(' ')

    var roles = ['112134654', '154564654654', '56456465445', '464654656']; /* занесите в 
    этот массив ID всех своих ролей */

    if (roles.indexOf(args[1]) === -1) { // если роль в массиве не найдена, то . . .

      // ... //

    } else {

      // ... //

    }
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question