Пример #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)