[英]I am trying to make A JS bot who sends images
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;
}
});
In the terminal, I get the error, ReferenceError: Cannot access 'attachment' before initialization.在终端中,我收到错误 ReferenceError:在初始化之前无法访问“附件”。 Please advise.请指教。
In在
const attachment = new attachment('./kanyek.jpeg')
attachement has the exact same name as the attachment constructor.附件与附件构造函数具有完全相同的名称。 It's like saying就像在说
let ab = ab + 1
makes no sence.没有任何意义。 So changes attachment to something else所以改变对别的东西的依恋
const attach = new Attachment('./kanyek.jpeg')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.