You would usually grab the tags of a message
Then process the badges in the tags of that message
And then see if a mod or VIP badge is present
So:
@badge-info=subscriber/88;badges=moderator/1,subscriber/84,ambassador/1;client-nonce=60f008953dd3605f9295a92ceeaa5542;color=#033700;display-name=BarryCarlyon;emotes=;flags=;id=b8accce3-ece6-405c-9ad6-49b5d4aa8b18;mod=1;room-id=26610234;subscriber=1;tmi-sent-ts=1622298651298;turbo=0;user-id=15185913;user-type=mod :barrycarlyon!barrycarlyon@barrycarlyon.tmi.twitch.tv PRIVMSG #cohhcarnage :more moo
Extract the tags
@badge-info=subscriber/88;badges=moderator/1,subscriber/84,ambassador/1;client-nonce=60f008953dd3605f9295a92ceeaa5542;color=#033700;display-name=BarryCarlyon;emotes=;flags=;id=b8accce3-ece6-405c-9ad6-49b5d4aa8b18;mod=1;room-id=26610234;subscriber=1;tmi-sent-ts=1622298651298;turbo=0;user-id=15185913;user-type=mod
Then grab the badges
badges=moderator/1,subscriber/84,ambassador/1;
And you can look for the moderator or vip badge.
If using an IRC messageparser or something like
And thus assuming JavaScript
It’ll convert it into an object
badges=moderator/1,subscriber/84,ambassador/1;
becomes something like
payload.tags['badges'] = {
'moderator': "1",
'subscriber': "1",
'ambassador': "1"
}
then in JS you can do
if (payload.tags['badges'].hasOwnProperty('moderator')) {
// is a mod
}
if (payload.tags['badges'].hasOwnProperty('vip')) {
// is a vip
}