久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

檢測機器人帳戶是否離線/在線

Detect if a bot account goes offline/online(檢測機器人帳戶是否離線/在線)
本文介紹了檢測機器人帳戶是否離線/在線的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在使用 presenceUpdate 事件,但是它觸發了兩次,我被告知它正在發射我與機器人共享的服務器數量.目前我的代碼輸出 online 兩次.我不確定如何讓它只輸出一次.

I am using the presenceUpdate event however, it is triggering twice, I am told it is emitting for how many shared servers I have with the bot. Currently my code outputs online twice. I am not sure on how to get it to output just once.

if (newPresence.userID === botid) {
  if (newPresence.status === 'online') {
    console.log(newPresence.status); // Should output 'online' currently outputs 'online online'

推薦答案

我注意到這個問題仍未解決,所以我會為您解決.所以上面的答案是正確的,但是,它們都沒有說明機器人為此需要的意圖.

I noticed that this remained unsolved, so I'll solve it for you. So the answers above are correct, however, none of them states the intents the bot requires for this.

你看,presenceUpdate 不會發出,除非你啟用了出席權限網關意圖.對于少于 100 個服務器中的機器人,可以通過翻轉開關在開發人員門戶上進行切換.否則,您需要為不和諧打開一張票以啟用存在意圖.

You see, presenceUpdate won't emit unless you have enabled the presence privilege gateway intent. For bots in less than 100 servers, this can be toggled on the developer portal by flipping a switch. Otherwise you need to open a ticket for discord to enable the presence intent.

啟用 Intent 后,試試這個:

Once you enable intents, try this:

client.on(`presenceUpdate`,(member)=>{
    console.log(`${member.user.username} has updated their presence.`)
})

然后嘗試將您的狀態更改為 dnd.如果你啟用它,你應該看到[您的標簽] 更新了他們的存在..否則你可能做錯了什么.

Then try changing your status to dnd. If you enabled it, you should see [your tag] has updated their presence.. Otherwise you may have done something wrong.

這篇關于檢測機器人帳戶是否離線/在線的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 午夜精品一区二区三区在线播放 | 久久精品毛片 | 一级欧美| 久久久亚洲精品视频 | 国产中文字幕av | 亚洲91精品 | 免费观看一级毛片视频 | 亚洲在线视频 | 欧美伊人久久久久久久久影院 | 国产精品一区二区无线 | 亚洲免费视频在线观看 | 国产一区二区久久久 | 亚洲国产欧美在线 | 91色在线| 久久精品视频网站 | 亚洲高清av | 国产免费视频 | 性色网站 | 国产黄色小视频在线观看 | 亚洲精品久久嫩草网站秘色 | 天堂成人国产精品一区 | 国产一区二区电影 | 欧美激情综合 | 国产色爽 | 国产一区二区三区四区五区加勒比 | 欧美日韩成人 | 国产福利在线播放麻豆 | 亚洲精品白浆高清久久久久久 | 久久久久国产一区二区三区四区 | 欧美成年人视频在线观看 | 色婷婷av一区二区三区软件 | 不卡一区二区在线观看 | 91超碰在线 | 久草在线在线精品观看 | 久久久毛片 | 亚洲欧美日韩在线不卡 | 亚洲一二三在线观看 | 国产探花在线精品一区二区 | 国产精品视频一区二区三区不卡 | 91偷拍精品一区二区三区 | 亚洲人成网站777色婷婷 |