Check if a username on the channel is a mod

Check the badges of the PRIVMSG to see if it contains a moderator badge

@badge-info=subscriber/92;badges=moderator/1,subscriber/90,ambassador/1;client-nonce=234f0b2816fb84fb201b7af6def7a2f5;color=#033700;display-name=BarryCarlyon;emotes=;flags=;id=9d5af3ef-ddcf-45f6-b526-0d72f959a1b9;mod=1;room-id=26610234;subscriber=1;tmi-sent-ts=1631718866602;turbo=0;user-id=15185913;user-type=mod :barrycarlyon!barrycarlyon@barrycarlyon.tmi.twitch.tv PRIVMSG #cohhcarnage :Mooo

If you parse the “badges” from that you can see I have the moderator badge.

How to extract this is up to you/depends how you are parsing chat.

With something like https://github.com/BarryCarlyon/twitch_misc/blob/main/chat/chat.js

Then under privmsg

Around line 255:

case 'PRIVMSG':
    if (payload.tags.badges.hasOwnProperty('moderator')) {
        // is moderator
    }
1 Like