Teekeks / pyTwitchAPI

A Python 3.7 compatible implementation of the Twitch API, EventSub, PubSub and Chat
https://pytwitchapi.dev
MIT License
254 stars 38 forks source link

added is_mod(room) to check if bot is a mod #196

Closed stolenvw closed 1 year ago

stolenvw commented 1 year ago

added is_mod(room) to check if bot is a mod added a USERSTATE handle and moved

        if parsed['source']['nick'][1:] == self.username:
            self._mod_status_cache[parsed['command']['channel'][1:]] = 'mod' if parsed['tags']['mod'] == '1' or \
                                                                                parsed['tags']['badges'].get('broadcaster') is not None else 'user'

from msg handle to the user state one, removing the if name check and the or check for being the broadcaster

twitch chat server does not send a PRIVMSG back to the bot after the bot sends a PRIVMSG for this to work in the msg handle

bot gets USERSTATE when joining a channel, and every time after bot sends a PRIVMSG