Hey everyone! I’m working on building a Discord bot that can automatically send notifications to my server whenever I start streaming. I’ve been using the discord.py library but I’m stuck on how to properly detect when streaming begins and then send the notification message.
I tried using voice state events but I’m not sure if that’s the right approach. Here’s what I have so far:
@client.event
async def on_member_update(before, after):
if before.activity != after.activity:
if after.activity and after.activity.type == discord.ActivityType.streaming:
print("Member started streaming!")
Any guidance on how to make this work properly would be really appreciated. Thanks in advance!
The on_member_update
event works well for this, but watch out - streaming detection gets wonky during Discord’s startup. I check if before.activity
is None before processing to avoid false triggers when people first come online. You’ll also want a cooldown since stream status flickers during connection issues. One thing that surprised me: the streaming activity object has useful properties like details
and name
for customizing notifications. Add error handling around your notification code too - channel permissions can cause silent failures that’ll drive you crazy debugging.
btw make sure you’ve got the right intents enabled or on_member_update
won’t fire. I forgot discord.Intents.members
and wasted hours figuring out why nothing worked lol. also discord takes a few seconds to register streaming status so don’t expect instant notifications
Your on_member_update
approach is spot on for catching streaming activity. The main problem is this event fires constantly - any activity change triggers it, not just streaming. I added extra checks to filter false positives and handle notifications properly. Make sure you’re not sending alerts if someone’s already streaming, or you’ll spam notifications every time they change their stream title. Throw in a small delay too since Discord loves sending rapid-fire updates when streaming starts. Your streaming detection code should work fine as-is, but you’ll need to build the actual notification system and track who’s currently streaming.