本文介绍了discord.js在线状态离线问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
client.on('message', message => {
let onlineCount = 0;
const guild = client.guilds.cache.get("538745138047090708");
guild.members.cache.find(member => {
if (member.presence.status == "online"){
onlineCount += 1
}
})
message.channel.send(`Online Players In Server: ${onlineCount}`)};
如您在图片中看到的bot所说,服务器中的在线播放器为0,但不是.服务器上的在线太多,但我不知道如何解决
As you see in picture bot says online players in server is 0 but it's not. There is too many online on server but i don't know how to fix it
推荐答案
由于我的声誉低下,因此我无法对您的问题发表评论.从 10月27日开始,不和谐的机器人需要启用状态提示功能.您可以在 applications> BotName> Bot
Since my reputation is low I cannot comment on your question. As of 27th of October discord bots need to enable presence intent. You can find that under applications>BotName>Bot
如果无法通过按钮启用它,则需要联系不和谐的支持团队.此处是文章
If you cannot enable it with button, you need to contact discord support team. Here is the article
这篇关于discord.js在线状态离线问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!