[英]How would I send a message to all discord servers my bot is in v14 discord.js?
[英]discord.js v14 trying to do that my bot status will be the amount of servers that the bot is in them
我正在嘗試這樣做,我的機器人狀態將是他在其中的服務器數量。
我試過了:
client.on("ready", () => {
// let guildsCount = client.guilds.size
client.user.setPresence({
activities: [
{ name: `${client.guilds.size} Servers!`, type: ActivityType.Watching },
],
status: "online",
});
});
它說正在觀看未定義的服務器!
我也試過:
let guildsCount = client.guilds.cache.map(guild => guild.);
但我不知道在“。”之后該做什么。 要獲得我也嘗試過的公會數量:
let guildsCount = client.guilds.cache.get()
但是說看未定義也沒有用
client.guilds.size將作為undefined返回給您。 您應該使用client.guilds.cache.size
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.