コード例 #1
0
def h_command(bot, id, target, event, body, full_msg, action):
    bot.activity = False

    #=================================================================
    # (This should be in bridge.py.)
    s_event = ('SIMPLE', 'ACTION', event) if action else \
              ('SIMPLE',           event)
    no_echo = [False]
    replies = []
    def cmd_reply(rmsg=None, from_name=None, no_bridge=False, **kwds):
        if rmsg is not None or from_name is not None:
            if rmsg is None: rmsg = from_name(id.nick)
            replies.append(((bot, id, target, rmsg), kwds))
        no_echo[0] = no_echo[0] or no_bridge
    yield sign(s_event, bot, id.nick, target, body, cmd_reply)
    if not no_echo[0]:
        cmsg = ('* %s %s' if action else '<%s> %s') % (id.nick, full_msg)
        yield sign('IRC', bot, target, cmsg)
    for rargs, rkwds in replies:
        reply(*rargs, **rkwds)       
    #=================================================================
        
    if limit.mark_activity(bot, id, notify=target):
        return
    if action:
        event = ('ACTION', event)
    yield sign(event, bot, id, target, body, full_msg)
    if bot.activity: return
    yield sign('CMD_IGNORED', event, bot, id, target, body, full_msg)
コード例 #2
0
ファイル: fto.py プロジェクト: joodicator/fto-PageBot
def h_message(bot, id, target, msg):
    if not target: return
    if limit.is_ignored(id): return
    yield sign('FTO_MSG', bot, target, msg)
    if bot.activity: limit.mark_activity(bot, id)
コード例 #3
0
def h_message(bot, id, target, msg):
    if not kakasi_lib.is_ja(msg) or limit.mark_activity(bot, id): return
    kakasi(bot, id, target or id.nick, msg, target is not None)