voops   -  Nov 14, 2013

Hey.
I have a simple bot for a Twitch channel that runs in IRC. Most of it's all set up already, I was just curious how I'd right a script that would give the users in the twitch chat a list of the chat moderators that are currently online in the chat?

Thanks for the help

Yawhatnever  -  Nov 14, 2013

Users can type /mods already, or just click the viewer list...

voops  -  Nov 15, 2013

But that shows all of the moderators online or offline, and the viewer list sometimes bugs out when there's a lot of people in the channel. I'm just doing this at the request of the streamer.

Yawhatnever  -  Nov 15, 2013

msg # Online mods: $regsubex($left($str(@ $+ $chr(44), $nick(#, 0, o)), -1), /@/g, $nick(#, \n, o))

voops  -  Nov 15, 2013

Thanks man. Works like a charm :D

voops  -  Nov 15, 2013

Sorry to be so picky, but is there a way to get a space between each name in the list? I've never worked with any code like that, just very basic stuff so far so I don't know how to make that work in a more complex script like that one. Sorry, but thanks if you can help :)

Yawhatnever  -  Nov 15, 2013

$nick(#, 0, o) returns the number of nicks in the nicklist, including only ops.
$str(@ $+ $chr(44), N) repeats the string "@," N times, which is the number of ops in this case.
$left(, -1) is used to eliminate the trailing comma.
The $regsubex() substitution finds every '@' (/@/g) and replaces it with $nick(#, \n, o), where \n is the match number.

To add a space between the nicks you would add a space to the end of the string being repeated in $str(). Space == $chr(32).
Then use $left(, -2) because now you have two characters trailing the final name.

The end result is $regsubex($left($str($+(@, $chr(44), $chr(32)), $nick(#, 0, o)), -2), /@/g, $nick(#, \n, o))

voops  -  Nov 15, 2013

thank you so much. Works perfectly now. Much appreciated. :D

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.