0

I started recently with NodeJS wrote a small discord Bot.

Currently I wanted to understand why I get the output 2 times in my if statement:

if (command === "commands" || command === "help") {
        if (args[0] === "mods") {
            if (g.members.filter(m => m.roles.includes(ModR.id)) || g.members.filter(m => m.roles.includes(AdminR.id))) {
                cmds = "`" + config.cmdPrefix + "temprole @mention <DAYS> <ROLE-NAME>`   \\\u00BB   to assign a temporary roles\n"
                    + "`" + config.cmdPrefix + "temprole check @mention`   \\\u00BB   to check the time left on a temporary role assignment\n"
                    + "`" + config.cmdPrefix + "temprole remove @mention`   \\\u00BB   to remove a temporary role assignment\n"
                    + "`" + config.cmdPrefix + "temprole add @mention <DAYS>`   \\\u00BB   to add more time to a temporary role assignment\n";
                bot.createMessage(c.id, cmds).catch((err) => { console.log(err) });
            }

I'm checking here if an user has Mod or Admin rights and when an Admin is executing the ?help mods command I get the output twice

Discord output:

?temprole @mention <DAYS> <ROLE-NAME>   »   to assign a temporary roles
?temprole check @mention   »   to check the time left on a temporary role assignment
?temprole remove @mention   »   to remove a temporary role assignment
?temprole add @mention <DAYS>   »   to add more time to a temporary role assignment
?temprole @mention <DAYS> <ROLE-NAME>   »   to assign a temporary roles
?temprole check @mention   »   to check the time left on a temporary role assignment
?temprole remove @mention   »   to remove a temporary role assignment
?temprole add @mention <DAYS>   »   to add more time to a temporary role assignment

any help or hint would be appriciated

Acocalypso
  • 17
  • 2
  • 5

0 Answers0