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

如何列出來自特定服務(wù)器的所有成員?

How to list all members from a specific server?(如何列出來自特定服務(wù)器的所有成員?)
本文介紹了如何列出來自特定服務(wù)器的所有成員?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我的代碼是

const list = client.guilds.find("id", "335507048017952771")
       for (user of list.users){
         console.log(user[1].username);
       }

這實(shí)際上沒有任何作用.沒有錯(cuò)誤或任何東西.

This does literally nothing. There is no error or anything.

我只想讓機(jī)器人找到一個(gè)服務(wù)器,然后記錄來自該服務(wù)器的所有成員.

I just want the bot to find a server and then log all members from said server.

顯示所有連接的用戶 Discord.js 這個(gè)問題的答案沒有一點(diǎn)也幫不上我.我確實(shí)嘗試使用 message.guild.users 但這也沒有做任何事情.似乎在 Discord 上找不到任何內(nèi)容.js 網(wǎng)站 來幫助我.

Displaying all connected users Discord.js The answers in this question didn't really help me at all. I did try using message.guild.users but that also did nothing. Can't seem to find anything on the Discord.js site to help me either.

推薦答案

首先,不要使用.find("id", "335507048017952771"),你應(yīng)該使用.get("335507048017952771"),正如它在 discord.js 文檔.

Firstly, don't use .find("id", "335507048017952771"), you should be using .get("335507048017952771"), as it says on the discord.js documentation.

Discord.js 中使用的所有集合都使用它們的 id 屬性進(jìn)行映射,如果你想通過 id 查找,你應(yīng)該使用 get 方法.有關(guān)詳細(xì)信息,請參閱 MDN.p>

All collections used in Discord.js are mapped using their id property, and if you want to find by id you should use the get method. See MDN for details.

一個(gè) Guild 沒有 users 屬性,因?yàn)樗幸粋€(gè) members 屬性,返回 Collection.現(xiàn)在獲取 username 從每個(gè)成員你可以從 user 屬性.因此,您需要遍歷 GuildMember 的集合,并獲取 <GuildMember>.user.username.

A Guild does not have a users property, where as it has a members property, which returns a Collection of GuildMembers. Now to get the username from each member you can obtain that from the user property of the GuildMember. So, you will need to iterate through the collection of GuildMembers, and get the <GuildMember>.user.username.

有幾種方法可以做到這一點(diǎn),我將使用 forEach() 方法.結(jié)果如下:

There are several ways to do this, I will be using the forEach() method. Here's what that would look like as a result:

// Get the Guild and store it under the variable "list"
const list = client.guilds.get("335507048017952771"); 

// Iterate through the collection of GuildMembers from the Guild getting the username property of each member 
list.members.forEach(member => console.log(member.user.username)); 

這篇關(guān)于如何列出來自特定服務(wù)器的所有成員?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

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(如何讓我的機(jī)器人提及發(fā)出該機(jī)器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來加載 ES 模塊 discord.js)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時(shí)的歡迎消息)
Discord.js Delete Single Message(Discord.js 刪除單個(gè)消息)
主站蜘蛛池模板: 在线成人av | 精品久久免费 | 亚洲欧美精品国产一级在线 | 在线播放一区二区三区 | 亚洲一区二区三区在线播放 | 黄视频网站免费观看 | 亚洲 日本 欧美 中文幕 | 日韩免费一区二区 | 亚洲一区二区久久 | 国产小网站 | 亚洲精品乱码久久久久久蜜桃 | 天天操天天干天天爽 | 欧美黑人巨大videos精品 | 真人一级毛片 | 97国产在线观看 | 成人午夜免费在线视频 | 亚洲第一天堂 | 久久成人精品一区二区三区 | 亚洲精品白浆高清久久久久久 | 国产日韩精品一区 | 亚洲少妇综合网 | 亚洲一区二区黄 | 日本不卡一区二区三区 | 日韩精品久久一区二区三区 | 91精品久久久久久久久久入口 | 91精品久久久久久久久 | av国产精品毛片一区二区小说 | 蜜桃av一区二区三区 | 国产精品久久国产精品99 gif | 国产一区二区精品在线观看 | 精品久久久精品 | 国产乱码精品一区二区三区五月婷 | 黄一区二区三区 | 91精品国产综合久久小仙女图片 | 久久久久久高潮国产精品视 | 99re在线播放 | 久久久视频在线 | 国产精品久久久久久婷婷天堂 | 成人小视频在线观看 | 三级在线免费 | 亚洲免费视频网站 |