class BTTVEmoteManager: def __init__(self, emote_manager): from tyggbot.apiwrappers import BTTVApi self.emote_manager = emote_manager self.bttv_api = BTTVApi() def update_emotes(self): log.debug('Updating BTTV Emotes...') emotes = self.bttv_api.get_global_emotes() emotes += self.bttv_api.get_channel_emotes(self.emote_manager.streamer) self.emote_manager.bot.mainthread_queue.add(self._add_bttv_emotes, args=[emotes]) def _add_bttv_emotes(self, emotes): for emote in emotes: key = 'custom_{}'.format(emote['code']) if key in self.emote_manager.data: self.emote_manager.data[key].emote_hash = emote['emote_hash'] else: self.emote_manager.add_emote(**emote) log.debug('Added {} emotes'.format(len(emotes)))
def __init__(self, emote_manager): from tyggbot.apiwrappers import BTTVApi self.emote_manager = emote_manager self.bttv_api = BTTVApi()