Преглед на файлове

Add a 'part' hook. Updates.

tags/v0.2
Ben Kurtovic преди 9 години
родител
ревизия
a17f0ec47b
променени са 4 файла, в които са добавени 14 реда и са изтрити 6 реда
  1. +3
    -0
      CHANGELOG
  2. +4
    -3
      docs/customizing.rst
  3. +3
    -3
      earwigbot/commands/__init__.py
  4. +4
    -0
      earwigbot/irc/frontend.py

+ 3
- 0
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.


+ 4
- 3
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


+ 3
- 3
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):


+ 4
- 0
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:


Зареждане…
Отказ
Запис