【发布时间】:2021-08-22 16:10:17
【问题描述】:
我正在使用discord.js V12 开发Discord Bot,但我的代码中有一些我不明白的行。
我的命令处理程序:
const fs = require('fs');
module.exports = (client, Discord) => {
const command_files = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of command_files) {
const command = require(`../commands/${file}`);
//This is the if statement I dont understand
if(command.name)
{
client.commands.set(command.name, command); // and also this line thx.
} else
{
continue;
}
}
};
谁能给我解释一下?谢谢。
【问题讨论】:
-
@Toasty 感谢它的帮助,感谢您让我的问题变得更好
标签: node.js discord.js