我正在用 discord.py 制作一个不和谐的机器人。机器人应该加入 VC 并等待 5 分钟,然后离开。出于测试目的,此数字已设置为 2 秒。现在的问题是,当机器人加入时,等待功能被完全忽略。不管我把它设置成什么。
我尝试了更大的数字,但这也不起作用。
#The part of the code I'm having trouble with:
try:
vc = await ctx.guild.get_channel(int(chanid)).connect()
time.sleep(2)
await vc.disconnect()
except:
print(f"Action Failed: JoinVC.")
#Keep in mind, this is only part of the code.
我希望机器人尝试加入频道,2 秒后离开。当代码按原样运行时,我没有收到任何错误消息。
哈士奇WWW
相关分类