(await PG(`${process.cwd()}/Commands/*/*.js`)).map(async (file) => {
const command = require(file);
if(!command.name)
return Table.addRow(file.split("/")[7], "FAILED", "Missing a name.")
if(!command.description)
return Table.addRow(command.name, "FAILED", "Missing a description.")
if(command.permission) {
if(Perms.includes(command.permission))
command.defaultPermission = false;
else
return Table.addRow(command.name, "FAILED", "Permission is invalid.")
}
client.commands.set(command.name, command);
CommandsArray.push(command);
await Table.addRow(command.name, "SUCCESFUL");
});这个回来了
.
||
|
'基本上,我想记录一个命令处理程序,但是它不能工作,也不会加载我的命令。
发布于 2022-08-30 04:59:49
你需要做一个这样的变量:
const dir = process.cwd().replace(/\\/g, '/');在此之后,您需要将行更改为:
(await PG(`${process.cwd()}/Commands/*/*.js`)).map(async (file) => {至:
(await PG(`${dir}/Commands/*/*.js`)).map(async (file) => {https://stackoverflow.com/questions/69934408
复制相似问题