所以我正在尝试使用 python 中的 discord.py 库为我的突袭不和谐编写一个突袭机器人。这个脚本应该在语音 channel 中形成一个成员列表以进行突袭。出于某种原因,此脚本不起作用。每当打印 memids 时,它只会打印一个空列表。
如果有人熟悉 discord.py 并且可以告诉我为什么这不起作用,请这样做。这真的让我很困扰,我已经尝试了我所知道的一切来解决它。
#find raiding
voice_channel = discord.utils.get(ctx.message.server.channels, id = '440014722587426816')
#finds the members
members = voice_channel.voice_members
memids = []
for member in members:
memids.append(member.id)
print(memids)
最佳答案
如果您知道 channel 的 id,您可以这样做。对我有用:D
channel = client.get_channel(1234567890) #gets the channel you want to get the list from
members = channel.members #finds members connected to the channel
memids = [] #(list)
for member in members:
memids.append(member.id)
print(memids) #print info
关于python - (discord.py) 获取特定语音 channel 中所有成员的列表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50084002/