[英]How to get The Member id from this Value? Discord.py
您好,我需要獲取會員 ID,我嘗試了很多事情:
這是值: [<會員 id=審查名稱='Spaffel' 鑒別器='0581' bot=False nick=None guild=>, <會員 id=審查名稱='calvin.e.test' 鑒別器='1151' bot=假 nick=無公會=>]
你的價值類型叫什么?
如果我使用此代碼獲取 ID:
@client.command()
async def test123(ctx):
voice_channel = client.get_channel(channel_id) #i used the channel id but i removed it in this exampl
members2 = voice_channel.members
await ctx.send(f"User: {members2} ")
for index, member in enumerate(members2):
testlol = (id)
await ctx.send(f"User: {testlol} ")
我得到這個 Output: 用戶:
我怎樣才能得到會員的ID請幫助我:)
要獲取語音頻道中成員的 ID,您可以通過語音頻道中的所有成員創建一個列表和 go。
看看下面的代碼:
@client.command()
async def test123(ctx):
voice_channel = client.get_channel(ChannelID)
members = voice_channel.members # Members that are connected to the channel
vcmember = [] # Creates a list
for member in members:
memids.append(member.id) # Get the IDs/add them to the list
await ctx.send(f"{vcmember}")
! 記得導入並激活 Intents !
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.