I’ve been working on a basic Twitch chatbot that responds to specific commands and phrases. Right now I have it set up to react when another bot posts welcome messages, but I want to make it more personal.
Is there a way to grab the username from these bot messages and include it in my response? I’m also curious if I can tap directly into Twitch’s built-in notifications instead of just watching for bot messages. You know, like when someone subscribes and you see that notification without the username prefix.
Any suggestions on how to access this kind of data through the Twitch API or IRC?
regex works great for parsing usernames, just watch out for edge cases with special characters. eventsub is def the best bet for real-time notifications - way more reliable than counting on streamlabs or nightbot msgs.
I’ve built chatbots for several streamers, and yeah, parsing IRC messages works but gets messy quick. Username extraction is easy once you get the format, but rate limits and reconnections are the real pain points. I switched to a hybrid setup - kept IRC for basic chat stuff but added EventSub for the important events like subs and follows. Took me a whole weekend to figure out the webhook setup, but it’s worth it. You get clean JSON instead of wrestling with regex on chat messages. Watch out though - some streamers disable bot announcements, so your bot might randomly break if they mess with their Streamlabs settings. EventSub fixes that since it comes directly from Twitch’s servers.
totally! to get usernames from irc msgs, split at the colon. but for twitch events, use the EventSub API. it gives you direct alerts for subs and follows, way easier than parsing chat!
I dealt with this exact problem six months ago. To extract usernames from IRC messages, parse the PRIVMSG format - the username sits between the exclamation mark and @ symbol in the prefix. But don’t rely on other bots for welcome messages. Different channels use different bot setups, so you’ll get inconsistent results. For Twitch notifications, IRC won’t give you sub or follow events directly. You’ll need Twitch’s EventSub webhooks running alongside your IRC bot. Set up an endpoint to catch HTTP callbacks from Twitch when events happen. It’s harder to learn but way more reliable than trying to parse chat messages for event data.