Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript discord.js禁止/踢命令_Javascript_Node.js_Discord.js - Fatal编程技术网

Javascript discord.js禁止/踢命令

Javascript discord.js禁止/踢命令,javascript,node.js,discord.js,Javascript,Node.js,Discord.js,基本上我只需要简单的命令,让我输入 { 如果(!message.content.startsWith(prefix)| | message.author.bot)返回; const args=message.content.slice(prefix.length.split(+/); const命令=args.shift().toLowerCase(); 如果(命令=='ping>'){ message.channel.send('pong!'); } else if(命令=='test>'){

基本上我只需要简单的命令,让我输入

{ 如果(!message.content.startsWith(prefix)| | message.author.bot)返回; const args=message.content.slice(prefix.length.split(+/); const命令=args.shift().toLowerCase(); 如果(命令=='ping>'){ message.channel.send('pong!'); } else if(命令=='test>'){ message.channel.send('Test Working'); } else if(命令===“帮助>”){ message.channel.send(“”) } else if(命令===“youtube>”){ message.channel.send('https://www.youtube.com/channel/UCFK-ry9dVqsPsjr638g1ygw') } else if(命令==='kick>'){ } else(message.channel.send('该命令未重新确认,用于查看 命令列表(')) }) client.login('Token Here');
另外,我不需要它,但如果您愿意,您可以帮助我使后缀系统工作,而不必在我的命令结束时将其推到末尾。对于您尝试的代码,它不工作,因为在上没有
成员
属性。我认为您要尝试的是
msg.indications.members.first()
——这将为您提供作为GuildMember对象的第一个有效提及。从这里开始,您可以随意使用这些方法。

我必须上床睡觉,但我会在早上试试
if (msg.member.hasPermission("KICK_MEMBERS") {
    if (msg.members.mentions.first()) {
        try {
            msg.members.mentions.first().kick();
        } catch {
            msg.reply("I do not have permissions to kick " + msg.members.mentions.first());
    }else {
        msg.reply("You do not have permissions to kick " + msg.members.mentions.first());
}
  const Discord = require('discord.js');

  const client = new Discord.Client();

  const prefix = '<';

  client.once('ready', () => {
console.log('Bot Online')
client.channels.cache.get('707840645192220714').send('Bot Online');
})

client.on('message', message => {
    if (!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();

if (command === 'ping>') {
    message.channel.send('pong!');
}
else if (command === 'test>') {
    message.channel.send('Test Working');
}
else if (command === 'help>') {
    message.channel.send('<Ping> <Test> <Help> <Youtube>')
}
else if (command === 'youtube>'){
    message.channel.send('https://www.youtube.com/channel/UCFK-ry9dVqsPsjr638g1ygw')
}
else if (command === 'kick>'){
         
    }

else (message.channel.send('That Command Isnt Reconised Use <Help> To View 
   A List Of Commands'))
   })

   client.login('Token Here');