jarvis_irc.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:jarvis 作者: anqxyr 项目源码 文件源码
def send(bot, text, private=False, notice=False):
    """Send irc message."""
    text = str(text)
    tr = bot._trigger
    jarvis.db.Message.create(
        user=bot.config.core.nick,
        channel=tr.sender,
        time=arrow.utcnow().timestamp,
        text=text)
    mode = 'NOTICE' if notice else 'PRIVMSG'
    recipient = tr.nick if private or notice else tr.sender
    try:
        bot.sending.acquire()
        text = textwrap.wrap(text, width=420)[0]
        bot.write((mode, recipient), text)
    finally:
        bot.sending.release()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号