const Discord = require('discord.js');
const client = new Discord.Client();
const PREFIX = "!";
client.on("message", (message) => {
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case "kanye":
message.channel.send('kanye kisses kanye; colorized')
const attachment = new attachment('./kanyek.jpeg')
console.log('kanye succesfully scoopity poopity')
break;
}
});
在终端中,我收到错误ReferenceError:初始化前无法访问“附件”。请告知。
答案 0 :(得分:0)
在
const attachment = new attachment('./kanyek.jpeg')
attachment具有与附件构造函数完全相同的名称。就像在说
let ab = ab + 1
没有意义。因此将附件更改为其他内容
const attach = new Attachment('./kanyek.jpeg')