예제 #1
0
def _format_user(bot, match):
    user_id, = match.groups()
    user = bot.get_nick(user_id)
    if user:
        if user_id == bot.user and bot.config['terminal_ping']:
            user = "******".format(user)
        return util.hilite_string('cyan', "@{}".format(user))
    return match.group(0)
예제 #2
0
def _format_notice(bot, match):
    notice, = match.groups()
    if notice in ('channel', 'everyone', 'group'):
        return util.hilite_string(
            'cyan',
            "@{}{}".format(notice,
                           "\a" if bot.config['terminal_ping'] else ""))
    return match.group(0)
예제 #3
0
def log_message_delete(bot, msg):
    msg[u'_logged'] = True
    with autoflush(bot):
        with util.hilite('cyan'):
            _log_message(
                bot,
                msg[u'channel_name'],
                "",
                util.hilite_string(
                    'gray',
                    "Deleted message from {}.".format(msg[u'deleted_ts'])),
            )
예제 #4
0
def _format_link(bot, match):
    url, = match.groups()
    return util.hilite_string('blue', url)
예제 #5
0
def _format_channel(bot, match):
    channel_id, = match.groups()
    channel = bot.get_channel_name(channel_id)
    if channel:
        return util.hilite_string('cyan', "#{}".format(channel))
    return match.group(0)
예제 #6
0
def get_cli_prefix(bot):
    return "[{}] ".format(
        util.hilite_string('cyan', bot.config['send_channel']))
예제 #7
0
 def debug_fn(string, color):
     with autoflush(bot):
         if color is not None:
             string = util.hilite_string(color, string)
         print(string)
예제 #8
0
def _format_notice(bot, match):
    notice, = match.groups()
    if notice in ('channel', 'everyone', 'group'):
        return util.hilite_string('cyan', "@{}\a".format(notice))
    return match.group(0)