I see that this topic is already marked as solved, but I see some things that are probably worth pointint/clearing out.
Also, I find it makes no difference experimentally if the CAP REQ happens before or after the JOIN. That kind of makes sense since those requests are not channel specific?
Just to add on top of that, it actually makes some difference but you won’t make much use of it - simply, sending CAPs before you send PASS message is the only way to receive GLOBALUSERSTATE message (which btw can be only sent once and only right after authenticating). But maybe this could turn out useful for you in the future, who knows.
P.S.: All channels on twitch have -n mode, which means you can send PRIVMSGs without joining any channel - same goes for messages like PRIVMSG #channel :/mods and you should also get your NOTICE back, even if you’re not JOINed the channel. Which also means that if you only care about getting lists of mods/vips you might not even need to JOIN any channels at all ![]()
Just to wrap this up if anyone stumbles on this thread in the future trying to get /vips and /mods from chat, here’s what I ended up with to process the output.
@robertsmania In the snippet you’ve posted, you rely on the message’s text itself which could always change, so a way better solution would be making use of msg-id tags. For these, it’s necessary to also request twitch.tv/tags CAP, which btw is shown in Barry’s example (but instead of doing that in 2 separate outgoing CAP REQ ... messages, both CAPs can be all requested with just one: CAP REQ :twitch.tv/tags twitch.tv/commands).
With both capabilities, you should get more verbose but also way more reliable messages, like so:
# outgoing messages: >
# incoming messages: <
> PRIVMSG #zneixbot :.vips
< @msg-id=no_vips :tmi.twitch.tv NOTICE #zneixbot :This channel does not have any VIPs.
> PRIVMSG #zneix :.vips
< @msg-id=vips_success :tmi.twitch.tv NOTICE #zneix :The VIPs of this channel are: ALazyMeme, Amayii, CollapsingWave, Eltefan, IceCreamDataBase, Leppunen, NotKarar, PepegePaul, Smaczny, Somso2e, Supinic, TETYYS, TeoTheParty, TranRed, Tsoding, WiFeSeN, YOSEFSA7, YOSEFSAA7, YUNG_RANDD, YungLPR, apa420, boring_nick, cbdg, fabZeef, flex3rs, foUrtf, jammehcow, matthewde, muskatico, nourylul, pajlada, randers, ravi0li_, rl_grey, romyDank, sbus, talenq, teischEnte, tolekk, xVeroNy, ツーツーツーツーツーツーツ
ーツーツーツ.
> PRIVMSG #cinipus :.mods
< @msg-id=no_mods :tmi.twitch.tv NOTICE #cinipus :There are no moderators of this channel.
> PRIVMSG #zneix :.mods
< @msg-id=room_mods :tmi.twitch.tv NOTICE #zneix :The moderators of this channel are: heryin, mm2pl, mm_sutilitybot, senderak, testaccount_420, zneixbot
and that makes it just a matter of parsing incoming NOTICE messages and accessing its msg-id tags. Keep in mind that a NOTICE message should pretty much always include said tag telling you which kind of message it is, so you can just check for no_vips, vips_success, no_mods or room_mods (as shown above).
Last but not least is a little warning that vips_success shows display names instead of login names, so you might get a username that could contain non-ascii localized display names (just like in the example of PRIVMSG #zneix :.vips.
sorry if I was too verbose, I’ve tried to share as much of my knowledge as possible ;p