def send_messages(bot, parsed_email): # Ignore *all* gerrit changes. We don't even need them in the firehose # since grrrit-wm exists there if is_gerrit_change(parsed_email): return sent_once = False # first, build the message for channel, channel_conf in channels.items(): # Works with just a lambda by default # You can pass additional options by making it a tuple if hasattr(channel_conf, '__call__'): filter = channel_conf params = {} else: filter, params = channel_conf if filter(parsed_email): msg = build_message(parsed_email, **params) bot.privmsg(channel, msg) sent_once = True # If we didn't match any channel, send to the default one if not sent_once: msg = build_message(parsed_email) bot.privmsg(default_channel, msg) # Send to the firehose anyway msg = build_message(parsed_email) bot.privmsg(firehose_channel, msg)
def send_messages(bot, parsed_email): # first, build the message for channel, channel_conf in channels.items(): # Works with just a lambda by default # You can pass additional options by making it a tuple if hasattr(channel_conf, '__call__'): filter = channel_conf params = {} else: filter, params = channel_conf if filter(parsed_email) and not is_gerrit_change(parsed_email): msg = build_message(parsed_email, **params) bot.privmsg(channel, msg)
def run(self): self.logger.info("[run] Iniciando...") for channel_url, channel_info in channels.items(): self.extract_channel(channel_url, channel_info)