浏览代码

commands.quit: use proper quit message when trigger is the bot's name

tags/v0.1^2
Ben Kurtovic 12 年前
父节点
当前提交
0f4dc4c78b
共有 2 个文件被更改,包括 11 次插入8 次删除
  1. +10
    -7
      earwigbot/commands/quit.py
  2. +1
    -1
      earwigbot/irc/data.py

+ 10
- 7
earwigbot/commands/quit.py 查看文件

@@ -44,13 +44,16 @@ class Command(BaseCommand):

def do_quit(self, data):
args = data.args
nick = self.config.irc.frontend["nick"].lower()
if data.trigger != nick and (not args or args[0].lower() != nick):
self.reply(data, "to confirm this action, the first argument must be my nickname.")
return
if args[1:]:
msg = " ".join(args[1:])
self.bot.stop("Stopped by {0}: {1}".format(data.nick, msg))
if data.trigger == data.my_nick:
reason = " ".join(args)
else:
if not args or args[0].lower() != data.my_nick:
self.reply(data, "to confirm this action, the first argument must be my name.")
return
reason = " ".join(args[1:])

if reason:
self.bot.stop("Stopped by {0}: {1}".format(data.nick, reason))
else:
self.bot.stop("Stopped by {0}".format(data.nick))



+ 1
- 1
earwigbot/irc/data.py 查看文件

@@ -28,7 +28,7 @@ __all__ = ["Data"]

class Data(object):
"""Store data from an individual line received on IRC."""
def __init__(self, bot, line):
self.line = line
self.my_nick = bot.config.irc["frontend"]["nick"].lower()


正在加载...
取消
保存