如果条件下 NodeJS 双输出

问题描述

我最近开始用 NodeJS 写了一个不和谐的小机器人。

目前我想了解为什么我在 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

任何帮助或提示都会被感谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...