【发布时间】:2021-05-07 19:42:26
【问题描述】:
嘿,我正在尝试检查特定用户是否在语音频道中。检索频道中的用户是可行的,但如果某个 id 在那里,我无法通过“if”找到。我从 Python 列表中获取用户 ID。我不知道该怎么办请帮忙:)
@client.command()
async def foo(ctx):
t = len(memberlist)
countermem = 0
for _ in range(t):
voice_channel = client.get_channel(802195467278352407)
voice_state = ctx.member.voice
ids = voice_channel.voice_states.keys()
userid = memberlist[(countermem)]
channelid = discord.VoiceChannel
voice_state = userid.member.voice
if voice_state is None:
print ("Somesssssssssssng")
print(channelid)
print ("Some thing")
id = memberlist[(countermem)]
print(id)
fullstring = voice_channel.voice_states.keys()
substring = "700388090631421982"
if memberlist[(countermem)] in voice_channel.voice_states.keys():
print("is in a channel")
if id in voicestats:
voicestats[id] += 10
_savestats()
print("it worked")
else:
print("was not in stats file")
voicestats[id] = 10
_savestats()
else:
print("not in a channel")
countermem += 1
【问题讨论】:
标签: python discord.py