deals with whether the message has to start with the name of the *bot* or not,
and to what extent.
Prefix policies can be one of:
* PrefixPolicy.direct,
where the raw command is expected without any message prefix at all;
the command is simply that string: "seen".
* PrefixPolicy.prefixed,
where the message has to start with the command *prefix* character
or string (usually ! or .): "!seen".
* PrefixPolicy.nickname,
where the message has to start with bot's nickname:
"kameloso: seen" -- except if it's in a QUERY message.
The plugin system will have made certain we only get messages starting with
"seen", since we annotated this function with such a
IRCEventHandler.Command.
It will since have been sliced off, so we're left only with the "arguments"
to "seen". IRCEvent.aux[$-1] contains the triggering
word, if it's needed.
If this is a CHAN event, the original lines
could (for example) have been "kameloso: seen Joe", or merely "!seen Joe"
(assuming a "!" prefix). If it was a private QUERY
message, the kameloso: prefix will have been removed. In either case, we're
left with only the parts we're interested in, and the rest sliced off.
As a result, the IRCEventevent would look something
like this (given a user foo querying "!seen Joe" or "kameloso: seen Joe"):
Whenever someone says "!seen" in a CHAN or a QUERY, and if CHAN then only if in a *home*, this function triggers.
The IRCEventHandler.Command.word annotation defines a piece of text that the incoming message must start with for this function to be called. IRCEventHandler.Command.policy
deals with whether the message has to start with the name of the *bot* or not, and to what extent.
Prefix policies can be one of:
* PrefixPolicy.direct, where the raw command is expected without any message prefix at all; the command is simply that string: "seen".
* PrefixPolicy.prefixed, where the message has to start with the command *prefix* character or string (usually ! or .): "!seen".
* PrefixPolicy.nickname, where the message has to start with bot's nickname: "kameloso: seen" -- except if it's in a QUERY message.
The plugin system will have made certain we only get messages starting with "seen", since we annotated this function with such a IRCEventHandler.Command. It will since have been sliced off, so we're left only with the "arguments" to "seen". IRCEvent.aux[$-1] contains the triggering word, if it's needed.
If this is a CHAN event, the original lines could (for example) have been "kameloso: seen Joe", or merely "!seen Joe" (assuming a "!" prefix). If it was a private QUERY message, the kameloso: prefix will have been removed. In either case, we're left with only the parts we're interested in, and the rest sliced off.
As a result, the IRCEvent event would look something like this (given a user foo querying "!seen Joe" or "kameloso: seen Joe"):
Lastly, the IRCEventHandler.Command.description
annotation merely defines how this function will be listed in the "online help" list, shown by triggering the HelpPlugin's' "help" command.