久久久久久久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 服務器時的歡迎消息)
主站蜘蛛池模板: 国产在线观看 | 国产女人第一次做爰毛片 | 精品日韩 | 日韩精品一二三 | 国产成人精品久久二区二区91 | 国产一区二区三区四区 | 中文字幕不卡在线观看 | 欧美1区2区| 国产精品视频免费播放 | 天天躁日日躁xxxxaaaa | 一区欧美| 国产高清精品一区二区三区 | 99久久精品视频免费 | 国产成人精品一区二区三区视频 | 日韩精品在线一区 | 成人深夜福利 | 欧美一级视频免费看 | 欧美精品一区在线发布 | 亚洲午夜精品久久久久久app | 国产精品精品久久久久久 | 亚洲欧美日韩在线一区二区 | 国产一区视频在线 | 亚洲人在线| 国产精品久久久亚洲 | 成人国产一区二区三区精品麻豆 | 中文字幕高清 | 国产精品激情 | 一区二区久久 | 精品欧美乱码久久久久久1区2区 | 国产欧美三区 | 中国美女撒尿txxxxx视频 | 亚洲小说图片 | 国产一区二区毛片 | 国产精品一区久久久 | 久亚州在线播放 | 99精品国产一区二区三区 | 日日av| 久久精品男人的天堂 | av网站在线播放 | 色网站视频| 黄色毛片免费看 |