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()
评论列表
文章目录