[英]How to get The Member id from this Value? Discord.py
Hello i need to get the Member id ive tried many things:您好,我需要获取会员 ID,我尝试了很多事情:
This is the Value: [<Member id=censored name='Spaffel' discriminator='0581' bot=False nick=None guild=>, <Member id=censored name='calvin.e.test' discriminator='1151' bot=False nick=None guild=>]这是值: [<会员 id=审查名称='Spaffel' 鉴别器='0581' bot=False nick=None guild=>, <会员 id=审查名称='calvin.e.test' 鉴别器='1151' bot=假 nick=无公会=>]
What is thy type of value called?你的价值类型叫什么?
If i use this code to get the ids:如果我使用此代码获取 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} ")
I get this Output: User:我得到这个 Output: 用户:
How can i get the id of the Member please help me:)我怎样才能得到会员的ID请帮助我:)
To get the ID of the members in a voice channel you can create a list and go through all the members in a voice channel.要获取语音频道中成员的 ID,您可以通过语音频道中的所有成员创建一个列表和 go。
Have a look at the following code:看看下面的代码:
@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}")
! ! Remember to import and activate Intents !记得导入并激活 Intents !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.