问题描述
我最近开始用 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 (将#修改为@)