def kakasi(bot, id, target, msg, prefix=True, auto=False, **kwds): if auto and not kakasi_lib.is_ja(msg): return raw_reply = kakasi_lib.kakasi(msg) if auto and len(raw_reply) > 200: return reply = ('<%s> %s' % (id.nick, raw_reply)) if prefix and id else raw_reply bot.send_msg(target, reply) bot.drive('runtime.later', sign( 'PROXY_MSG', bot, id, target, raw_reply, **dict(kwds, no_kakasi=True)))
def h_proxy_message(bot, id, target, msg, no_kakasi=False, **kwds): if no_kakasi or not kakasi_lib.is_ja(msg): return kakasi(bot, id, target, msg, target.startswith('#'), **kwds)
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)