当前位置: 首页 > 知识库问答 >
问题:

Discord bot停止发送欢迎消息

李耀
2023-03-14

因此,我用于让bot问候新用户的代码停止工作,我不知道为什么或如何使用这是im用于欢迎活动本身的代码```module.exports=(client)=>{const channelId='757493821251649608'//welcome channel const targetChannelId='757521186929246219'//rules and info

client.on('guildMemberAdd', (member) => {
  const message = `Hi, hope you enjoy your stay <@${
    member.id
  }> , Oh i almost forgot to tell you, check out! ${member.guild.channels.cache
    .get(targetChannelId)
    .toString()}`

  const channel = member.guild.channels.cache.get(channelId)
  channel.send(message)
})

}```

这就是我让机器人执行它的方式

const hi = require('./events/hi')
const hello = require('./events/hello')
const yo = require('./events/yo')
const whatsup = require('./events/whatsUp')
const bye = require('./events/bye')

client.once('ready', () =>{
    console.log('Aiko is working!');
    client.user.setActivity(' your orders!|Prefix is +', { type: "LISTENING" });
    hi(client)
    hello(client)
    yo(client)
    whatsup(client)
    bye(client)
    welcome(client)
});```

The event that should also send a message when someone leaves the server also doesn't go off, anyone any idea why?

共有1个答案

阴凯歌
2023-03-14

这很可能是一个特权意图问题,最近才需要这个问题。检查这个问题,看看它是否解决了它。还要阅读discord API文档以了解特权意图

 类似资料:
  • 我正在使用最新版本的google-cloud-pubsub,并且正在经历一个据称已经修复的bug。 我正在使用这个版本和其中的代码示例:https://pypi.org/project/google-cloud-pubsub/ 问题:因此,在我运行呼叫订阅者的订阅者工作者大约4-5小时后,它停止接收消息。 对如何修复它有什么建议吗?

  • 所以我用discord编写了一个discord机器人。js的一个特性是,当新用户加入服务器时,bot会发送一条消息。我现在不做嵌入,我以后可以自己做。 这是我的主要专为此功能制作的文件: 在我的文件中,我刚刚导入了该文件,并添加了。 但由于某些原因,我的代码没有出现在欢迎频道。。。任何帮助都将不胜感激。

  • 该站点的目标是成为 Jekyll 的全面指南。包括一些内容如:搭建和运行你的站点、创建以及管理内容、定制站点的展现和外观、在不同的环境中发布、以及参与到 Jekyll 将来的开发的一些建议。 Jekyll 究竟是什么? Jekyll 是一个简单的博客形态的静态站点生产机器。它有一个模版目录,其中包含原始文本格式的文档,通过一个转换器(如 Markdown)和我们的 Liquid 渲染器转化成一个完

  • 欢迎来到 Libra 开发者站点! Libra 的使命是建立一套简单的全球货币和金融基础设施,为数十亿人服务。 The world truly needs a reliable digital currency and infrastructure that together can deliver on the promise of “the internet of money.” Securi

  • 我有一个相当不错的机器人,我计划很快推出。它被称为版主,它应该是一个完美的版主机器人,这样服务器就不再需要真正的版主了。因此,我希望它在加入服务器时发送欢迎消息,但由于所有服务器都有不同的频道名称和频道,因此我无法获得通用的频道名称来发送欢迎消息。 这就是我现在看到的,正如您所看到的,它找到了一个名为general的频道,并将欢迎嵌入消息发送到general频道。但是,由于不是每台服务器都有一个通

  • 我正在开发一个基于微软bot框架的多渠道bot(专注于web和电报)(https://docs.microsoft.com/en-us/azure/bot-service/?view=azure-bot-service-4.0) 我被用户收到的最初消息所困扰。我的机器人基于Microsoft发布的复杂机器人:https://github.com/Microsoft/BotFramework-Sam