Discord bot有时会做出反应

编程入门 行业动态 更新时间:2024-10-11 13:21:16

Discord bot<a href=https://www.elefans.com/category/jswz/34/1701897.html style=有时会做出反应"/>

Discord bot有时会做出反应

最近,我在不和谐的bot上苦苦挣扎着制作一个小型且易于编写的脚本。该脚本应该使机器人对发布到某个频道的任何图像(只有图像)做出反应。问题是该机器人只在某些时候做出反应,当它做出反应时似乎确实是随机的,脚本从未真正按预期运行,但是在某些时候它确实可以在频道的每张图片上正常工作,重新启动后我故意使它再次随机运行。

client.on("message", message => {
if (message.author.bot) return;
let prefix = ';';

if (message.channel.id == showoffid){
  const collector = new Discord.MessageCollector(
    message.channel,
    m => m.author.id === message.author.id,
    {}
  );
  collector.on('collect', message => {
    if (message.attachments.size > 0) {
     message.react('✨')
      .catch(console.error);
      return;
    }
  })
}

if (message.channel.id == hundoid){
  const collector = new Discord.MessageCollector(
    message.channel,
    m => m.author.id === message.author.id,
    {}
  );
  collector.on('collect', message => {
    if (message.attachments.size > 0) {
     message.react(' 
          

更多推荐

Discord bot有时会做出反应

本文发布于:2024-05-06 23:23:20,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有时会   Discord   bot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!