本文介紹了檢查 Discord 服務器中是否存在用戶 ID的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我的 Discord 機器人需要檢查用戶是否在服務器中.我正在使用 node.js 和 discord.js.
My Discord bot needs to check whether a user is in the server or not. I'm using node.js and discord.js.
var USER_ID = randomNumbers
if (client.guild.member(USER_ID).exists){
do something
}
有沒有辦法做到這一點?
Is there a way to do this?
推薦答案
如果你有 Guild
對象,你可以使用 Guild.member()
方法.
If you have the Guild
object, you can use the Guild.member()
method.
let guild = client.guilds.get('guild ID here'),
USER_ID = '123123123';
if (guild.member(USER_ID)) {
// there is a GuildMember with that ID
}
這篇關于檢查 Discord 服務器中是否存在用戶 ID的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!