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

為什么client.guilds.cache.size 只說“0"?在我的游

Why does client.guilds.cache.size only say quot;0quot; in my playing status even if it#39;s in 2 servers?(為什么client.guilds.cache.size 只說“0?在我的游戲狀態中,即使它在 2 個服務器中?) - IT屋-程序員軟件開發技
本文介紹了為什么client.guilds.cache.size 只說“0"?在我的游戲狀態中,即使它在 2 個服務器中?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我見過很多人對 client.guilds.size 有問題,但我改用了最近建議的 client.guilds.cache.size.在我的播放狀態中,它只顯示 WATCHING my prefix | 0 servers." 嘗試獲取成員數和頻道數時也會發生同樣的情況.

i have seen many people who had trouble with client.guilds.size but I switched to the recently suggested client.guilds.cache.size. In my playing status, it only says "WATCHING my prefix | 0 servers." same happens for trying to fetch the member count and channel count.

let activities = [ `${client.guilds.cache.size} servers`, `${client.channels.cache.size} channels`, `${client.users.cache.size} users` ], i = 0;

setInterval(() => client.user.setActivity(`${prefix}help | ${activities[i ++ % activities.length]}`, { type: "WATCHING"}),`${process.env.INTERVAL}`)

這是我用來實現這一目標的腳本.我已經有一個 Eval 命令,它也返回 2.

This is the script I am using to achieve that. I already have an Eval command, that returns 2 aswell.

我似乎無法以某種方式找到解決方案.我希望你能幫助我,如果你需要什么,請告訴我!

I can't seem to find a solution to this somehow. I hope you can help me, if you need anything, tell me!

推薦答案

你的問題是你的client在你抓取guilds集合之前沒有登錄

Your issue is that your client has not logged in before you grab the guilds collection

您需要將該代碼放入您的 ready 事件中.

You need to place that code inside your ready event.

client.on('ready', () => {
  let activities = [ `${client.guilds.cache.size} servers`, `${client.channels.cache.size} channels`, `${client.users.cache.size} users` ], i = 0;

  setInterval(() => client.user.setActivity(`${prefix}help | ${activities[i ++ % activities.length]}`, { type: "WATCHING"}),`${process.env.INTERVAL}`)
})

這篇關于為什么client.guilds.cache.size 只說“0"?在我的游戲狀態中,即使它在 2 個服務器中?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 服務器時的歡迎消息)
主站蜘蛛池模板: 免费国产视频在线观看 | 成人在线视频网 | 精品久久久久久久久久久久久久 | 亚洲国产精品人人爽夜夜爽 | 久久国产传媒 | 欧洲一区二区视频 | 亚洲在线视频 | 日本成人中文字幕 | h视频免费在线观看 | 国产高清精品网站 | 欧美日韩一区二区三区四区五区 | 亚洲精品成人网 | 久久久久国产一区二区三区 | 高清国产一区二区 | 国产精品自产av一区二区三区 | 天天干狠狠干 | 欧美一区不卡 | 亚洲精品成人av久久 | 欧美激情久久久 | 在线播放中文字幕 | 99re视频在线观看 | 伊人久久麻豆 | 丁香综合 | 久久久91 | 中文字幕一区二区三区不卡 | 亚洲啊v在线 | 亚洲国产精品一区二区三区 | 国产精品一区在线 | 成人免费影院 | 91精品久久久久久久久久入口 | 色资源在线 | 久久久国产精品网站 | 国产精品一区二区三区在线 | 2021狠狠天天天 | 久久i | 青青久久| 精精国产xxxx视频在线播放7 | 日本久久久一区二区三区 | 国产欧美一区二区三区国产幕精品 | 成人在线视频一区 | 人人色视频 |