0

我最近开始用 NodeJS 写了一个小的 discord Bot。

目前我想了解为什么我在 if 语句中得到 2 次输出:

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) });
            }

我在这里检查用户是否具有 Mod 或管理员权限,并且当管理员执行 ?help mods 命令时,我会得到两次输出

不和谐输出:

?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

任何帮助或提示都会被应用

4

0 回答 0