samedi 6 octobre 2018

Discord.js - Check if command is executed

I have a problem with my restriction system for commands. The message 'you dont have permission' will only run once (when you don't have the role). I'm aware that if you don't set a var (in this case checkrole) the code will be executed once however I don't know how to check when a command is executed.

So I could do something like this:

if  (command === ' ') {
    checkrole = false
}

Code of interest:

if (!message.member.roles.some(r => ["someone"].includes(r.name.toLowerCase())) && checkrole === false) {
    checkrole = true;
    return message.channel.send('Sorry, but you do not have the **permissions** to do that.');
  }

(var checkrole is defined - it begins as false (var checkrole = false;))

Kind regards, Ruben

Aucun commentaire:

Enregistrer un commentaire