我对编码很陌生,但我试图创建一个只有选定的用户 id 才能使用的命令
这是我的代码
const DiscordCommand = require('../../contracts/DiscordCommand')
const admins = ['445952068621041664','408507536791044096']
class OverrideCommand extends DiscordCommand {
onCommand(message) {
if(admins.includes(message.author.id)) {
let args = this.getArgs(message).join(' ')
if (args.length == 0) {
return message.reply(`No command specified`)
}
this.sendMinecraftMessage(`/${args}`)
message.reply(`\`/${args}\` has been executed`)
}
else
message.reply(`You dont have permissions to use this command!`)
}
}
module.exports = OverrideCommand
The
const admins = ['445952068621041664','408507536791044096']
包含应该能够使用该命令的人的用户ID,第一个ID是我的第一个具有用户ID的朋友445952068621041664它工作正常,但是当我的第二个朋友使用用户 ID 时408507536791044096使用的命令显示“您无权使用此命令”有人可以帮我解决这个问题吗?
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)