在列表列表中搜索---获取每个列表的答案---只需要一个答案
Searching in lists of lists --- get answers for each list --- just want one answer
我想检查 ctx.author 是否连接到这个 discord 公会的任何语音频道。
机器人会这样做,但是对于每个 ctx.author 不是的频道,机器人都会发送消息 "You need to be connected to a voice-channel!"
如何从成员列表中创建一个列表供机器人检查?
voice_channel_list = ctx.guild.voice_channels
for voice_channels in voice_channel_list:
if not ctx.author in voice_channels.members:
await ctx.send(embed=discord.Embed(color=discord.Color.red(), description=("You need to be connected to a voice-channel!")))
elif ctx.author in voice_channels.members:
pass #does something
我想检查 ctx.author 是否连接到这个 discord 公会的任何语音频道。 机器人会这样做,但是对于每个 ctx.author 不是的频道,机器人都会发送消息 "You need to be connected to a voice-channel!" 如何从成员列表中创建一个列表供机器人检查?
voice_channel_list = ctx.guild.voice_channels
for voice_channels in voice_channel_list:
if not ctx.author in voice_channels.members:
await ctx.send(embed=discord.Embed(color=discord.Color.red(), description=("You need to be connected to a voice-channel!")))
elif ctx.author in voice_channels.members:
pass #does something