【发布时间】:2020-12-28 02:38:51
【问题描述】:
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:在初始化之前无法访问“附件”。请指教。
【问题讨论】:
-
将附件命名为与您使用的附件构造函数不同的名称。 const myAttachment = new attachment('./kanyek.jpeg')
标签: javascript node.js discord.js bots