第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

我的 discord Bot 每次嘗試離線時(shí)都不會(huì)發(fā)送命令

我的 discord Bot 每次嘗試離線時(shí)都不會(huì)發(fā)送命令

狐的傳說(shuō) 2023-01-06 16:10:23
const Discord = require('discord.js')const Client = new Discord.Client();const {prefix,token} = require('./config.json');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('Ready!');});Client.on('message', message => {      if (!message.content.startsWith(prefix) || message.author.bot) return;  if (!Client.commands.has(command)) return;  const args = message.content.slice(prefix.length).trim().split(/ +/);  const command = args.content().toLowerCase();    try {    Client.commands.get(command).execute(message, args);  } catch (error) {    message.reply('error')  }});我希望有人可以提供幫助,我和我的朋友一直在努力修復(fù)錯(cuò)誤,但我們無(wú)法修復(fù)它我會(huì)將錯(cuò)誤發(fā)送給任何可以提供幫助的人,我和我的朋友在命令中有命令但我知道他們給了我們錯(cuò)誤。
查看完整描述

1 回答

?
米琪卡哇伊

TA貢獻(xiàn)1998條經(jīng)驗(yàn) 獲得超6個(gè)贊

只需if (!Client.commands.has(command)) return;在 的聲明之后移動(dòng)此行 () command。然后它應(yīng)該工作得很好。


const Discord = require('discord.js')

const Client = new Discord.Client();

const {prefix,token} = require('./config.json');

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('Ready!');

});


Client.on('message', message => {

  

  if (!message.content.startsWith(prefix) || message.author.bot) return;


  const args = message.content.slice(prefix.length).trim().split(/ +/);

  const command = args.content().toLowerCase();


  if (!Client.commands.has(command)) return;

  

  try {

    Client.commands.get(command).execute(message, args);

  } catch (error) {

    message.reply('error')

  }

});


查看完整回答
反對(duì) 回復(fù) 2023-01-06
  • 1 回答
  • 0 關(guān)注
  • 135 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)