def relay(self, bot, relay_ins):
        def channel_for(channel_id):
            return bot.slack_client.server.channels.find(channel_id)

        def name(channel):
            if self.name:
                if not channel.name.startswith(self.name):
                    return None
                return channel.name.split('-', 1)[1]
            else:
                return channel.name

        for data in relay_ins:
            if 'channel' in data:
                channel = channel_for(data['channel'])
                if channel is None:
                    continue

            if data['type'] == 'join':
                line = u'join #{}'.format(name(channel))
                self.irc_client.send_line(line)
            elif data['type'] == 'message':
                print('do?', data)
                message = data.get('text', '')
                try:
                    import html
                    message = html.unescape(message)
                except __HOLE__:
                    pass
                message = message.replace('\r', ' ').replace('\n', r' ')
                user_id = data.get('user', None)
                if user_id:
                    user = bot.slack_client.server.users.find(user_id)
                else:
                    user = None
                user  # usable, but not yet
                if message:
                    line = u'privmsg #{} :{}'.format(name(channel), message)
                    self.irc_client.send_line(line)
            else:
                line = u'privmsg #{} :{}'.format(self.config['irc'].get('nick', 'slairck'), unicode(data))
                self.irc_client.send_line(line)
dataset/ETHPy150Open youknowone/slairck/ircbot.py/IrcBot.relay