Reputation: 35
Is there a way to check whether a user in a voice channel is currently speaking or not?
Upvotes: 3
Views: 2893
Reputation: 6944
There isn't a way to directly tell from the docs if a user is speaking, unless you're planning on working with the bytes from the socket, but that's not the easiest thing to do.
If you have a push-to-talk voice channel set up in your guild, you could do something like this using the user's mute states:
@bot.event
async def on_voice_state_update(member, prev, cur):
if cur.self_mute and not prev.self_mute:
print(f"{member} stopped talking!")
elif prev.self_mute and not cur.self_mute:
print(f"{member} started talking!")
References:
Upvotes: 1