Ok, so Im a fucking idiot and im fairly new to coding. I’m trying to make a random level chooser for some friends (which Ive successfully done), but I’d also like to restrict it to just the mods of the channel.
I’m able to pass along a /mod command and get the NOTICE return with the mod list, but I cant, for the life of me, figure out how to capture that into a variable.
It seems like it should be really simple, but I cant figure it out and its driving me fucking crazy.
I’m doing it like this in my mod checker (javascript). Shouldn’t be too different to do in python.
// The moderators of this room are: 3ventic, notventic, ohbot
// Check that the message starts with "The moderators of this"
if (message.indexOf('The moderators of this') === 0) {
// Split from the colon
var usernames = message.split(': ');
// Check the array has 2 elements so the next line doesn't crash the app, if Twitch change the message format
if (usernames.length > 1) {
// Split the comma-separated list of names by comma
usernames = usernames[1].split(', ');
// usernames is [ '3ventic', 'notventic', 'ohbot' ]
}
}