diff --git a/CHANGELOG b/CHANGELOG index ec4a9e5..8cc57ec 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ v0.2 (unreleased): +- Added a new command syntax allowing the caller to redirect replies to another + user. Example: "!dictionary >Fred earwig" - Added 'rc' hook type to allow IRC commands to respond to RC watcher events. +- Added 'part' hook type as a counterpart to 'join'. - Added !stalk/!watch. - Added !watchers. - Added !epoch as a subcommand of !time. diff --git a/docs/customizing.rst b/docs/customizing.rst index 3336353..a0c2509 100644 --- a/docs/customizing.rst +++ b/docs/customizing.rst @@ -108,9 +108,10 @@ are the basics: - Class attribute :py:attr:`~earwigbot.commands.Command.hooks` is a list of the "IRC events" that this command might respond to. It defaults to ``["msg"]``, but options include ``"msg_private"`` (for private messages only), - ``"msg_public"`` (for channel messages only), and ``"join"`` (for when a user - joins a channel). See the afc_status_ plugin for a command that responds to - other hook types. + ``"msg_public"`` (for channel messages only), ``"join"`` (for when a user + joins a channel), ``"part"`` (for when a user parts a channel), and ``"rc"`` + (for recent change messages from the IRC watcher). See the afc_status_ plugin + for a command that responds to other hook types. - Method :py:meth:`~earwigbot.commands.Command.setup` is called *once* with no arguments immediately after the command is first loaded. Does nothing by diff --git a/earwigbot/commands/__init__.py b/earwigbot/commands/__init__.py index 5a7ee97..5cd7549 100644 --- a/earwigbot/commands/__init__.py +++ b/earwigbot/commands/__init__.py @@ -43,9 +43,9 @@ class Command(object): # be triggered by the command's name and its name only: commands = [] - # Hooks are "msg", "msg_private", "msg_public", and "join". "msg" is the - # default behavior; if you wish to override that, change the value in your - # command subclass: + # Hooks are "msg", "msg_private", "msg_public", "join", "part", and "rc". + # "msg" is the default behavior; if you wish to override that, change the + # value in your command subclass: hooks = ["msg"] def __init__(self, bot): diff --git a/earwigbot/irc/frontend.py b/earwigbot/irc/frontend.py index 393f191..27fadb6 100644 --- a/earwigbot/irc/frontend.py +++ b/earwigbot/irc/frontend.py @@ -62,6 +62,10 @@ class Frontend(IRCConnection): data = Data(self.bot, self.nick, line, msgtype="JOIN") self.bot.commands.call("join", data) + elif line[1] == "PART": + data = Data(self.bot, self.nick, line, msgtype="PART") + self.bot.commands.call("part", data) + elif line[1] == "PRIVMSG": data = Data(self.bot, self.nick, line, msgtype="PRIVMSG") if data.is_private: