Discord 机器人停止发送欢迎消息
Posted
技术标签:
【中文标题】Discord 机器人停止发送欢迎消息【英文标题】:Discord bot stopped sending welcome messages 【发布时间】:2021-02-22 07:12:29 【问题描述】:所以,我让机器人迎接新用户的代码停止工作,我不知道为什么或如何 这是我用于欢迎事件本身的代码 ```module.exports = (client) => const channelId = '757493821251649608' // 欢迎频道 const targetChannelId = '757521186929246219' // 规则和信息
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?
【问题讨论】:
看看这是否回答了你的问题,***.com/questions/64739350/… 一个小而有用的提示,您可以使用$member
而不是提及ID,因为member
是您可以提及的公会成员
这能回答你的问题吗? Discord.js Bot Welcomes Member, Assign a Role and send them a DM
这能回答你的问题吗? None of my discord.js guildmember events are emitting, my user caches are basically empty, and my functions are timing out?
【参考方案1】:
这很可能是最近才需要的特权意图问题。查看this 问题,看看它是否解决了问题。另请阅读 privileged intents 的不和谐 API 文档
【讨论】:
以上是关于Discord 机器人停止发送欢迎消息的主要内容,如果未能解决你的问题,请参考以下文章
如何在 discord.js 上为 discord 服务器的新成员发送欢迎消息?