所以我的意思是我想在函数中导出某个对象。
async function Set(x) {
module.exports["x"] = x
}
这似乎不起作用,它变得未定义,你们能帮忙吗?
client.on('message', async message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
var args = message.content.split(/[ ]+/)
const Cargs = message.content.slice(prefix.length).trim().split(/[ ]+/);
const command = Cargs.shift().toUpperCase();
if (client.commands.get(command)) {
await Set(message)
client.commands.get(command).execute()
}
})