不和谐的机器人重复7次

时间:2020-10-26 18:52:56

标签: javascript discord.js bots

所以我是第一次制造一个不和谐的机器人。因此,直到机器人开始忽略该前缀之前,我一直表现不错。该命令连续重复了7次。它将多次执行该命令。


const client = new Discord.Client();

const prifix = '?';

const fs = require('fs');

client.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./Commands/').filter(file => file.endsWith('.js'))
for(const file of commandFiles){
 const command = require(`./Commands/${file}`);
 
 client.commands.set(command.name, command);
}

client.once('ready', () => {
  console.log('wow it came on!!');
});

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

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

  if(command === 'ping'){
      client.commands.get('ping').execute(message, args);

  } if  (command == 'youtube'){
      client.commands.get('youtube').execute(message, args);

  } if  (command == 'poop'){
      client.commands.get('poop').execute(message, args);

  } if  (command == 'No'){
      client.commands.get('No').execute(message, args);
 
  }
      
});

client.login('this is fine i just remove it ');

0 个答案:

没有答案