问题描述
您好,我正在尝试使用 discord.py 编写一个机器人,以便在我进行直播时通知我的 discord 服务器,但我不知道该怎么做。有人可以帮我吗?
谢谢
@bot.event
async def on_voice_state_update(member,prev,cur):
if prev.channel and cur.channel:
if prev.self_stream != cur.self_stream:
print("User's self-stream updated!")
解决方法
这可能有效:
YourID = #Enter your id here
@bot.event
async def on_voice_state_update(member,prev,cur):
if cur.self_stream and bool(cur.channel) and member.id == YourID:
print ("User's self stream updated")
我希望这会有所帮助。