简体   繁体   English

我正在尝试制作一个发送图像的 JS 机器人

[英]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.

相关问题 尝试制作将DM发送给用户的机器人 - Trying to make a bot that sends DMs to users 我正在尝试制作一个简单的 Discord 机器人来告诉时间 - I am trying to make a simple Discord bot that tells the time 如何让 discord 机器人在 discord.js 中发送消息后有表情符号反应? - How do I make discord bot have an emoji reaction after it sends its message in discord.js? 我正在尝试制作更新命令,该命令会发送您在 !update/!u 之后所说的所有内容 - I am trying to make !update command, which sends everything that you said after !update/!u 如何使 discord js 机器人在某个时间在 discord 的确切文本通道中发送随机消息(我创建一个列表并发送它) - How to make an discord js bot to send an random message(i make an list and he sends it) at some time in an exact text channel from discord 当我尝试踢比机器人角色更高的人时,它会失败但会发送消息 - When I try to kick someone who has higher roles than the bot it fails but sends msg 我正在尝试打开我的 discord 机器人。 但它向我展示了这条信息。 我安装了 discord.js - I am trying to open my discord bot . But it shows me this message . I have discord.js installed 我正在尝试获取 messageUpdate 日志,但改为发送 null - I am trying to get messageUpdate logs but sends null instead Discord.js - 我正在尝试创建一个不和谐的机器人,使语音通道中的所有连接成员静音 - Discord.js - I'am trying to create a discord bot that mutes all connected members in a voicechannel 我正在制作 Discord 机器人,它以特定消息触发的间隔发送消息但它不起作用? - I am making Discord bot that sends a message at an interval that is triggered by a particular message but its not working?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM