kibot.CommandHandler
index
/usr/src/rpm/BUILD/kibot-0.0.12/kibot/CommandHandler.py

 
Modules
       
kibot
re
string
time

 
Classes
       
kibot.BaseModule.BaseModule
CommandHandler
Command
ReplyObject
DirectConnectionReply
IRCReply

 
class Command
    An instance of this class will be created for each command, and
will be passed to every command function.  Creation is automatic
(in CommandHandler._do_command).
 
The public attributes are:
  cmd.bot      - the bot object
  cmd.nick     - nick of the user who executed the command
  cmd.nickmask - nickmask of the user who executed the command
  cmd.channel  - channel on which it was executed (or None if private)
  cmd.cmd      - the string command as it was typed
  cmd.args     - single string containing the args (stuff after cmd.cmd)
  cmd.event    - the raw event (instance of kibot.m_irclib.Event) that
                 led to the command (probably a pubmsg or privmsg event)
 
There are also a number of convenience methods (documented below):
  cmd.asplit(maxsplit=-1)
  cmd.shsplit(maxsplit=-1)
 
In addition to the above methods, each of the IRCReply methods are
copied in and are available directly as Command methods.
 
  Methods defined here:
__init__(self, **kwargs)
bot=self.bot, nick=nick, nickmask=nickmask, channel=channel,
cmd=cmd, args=args, _reply_object=reply, event=event
__str__(self)
asplit(self, maxsplit=-1)
split the arguments string on whitespace
shsplit(self, maxsplit=-1)
split the arguments string shell-style (quotes and backslashes)

 
class CommandHandler(kibot.BaseModule.BaseModule)
    This class is for handling bot commands.  An instance will
be stored as bot.command_handler, but has no public methods
and should not be accessed directly.
 
  Methods defined here:
__init__(self, bot)

 
class DirectConnectionReply(ReplyObject)
    This is the class for DirectConnection replies.  These basically
all do the same thing (write to the direct connection), but with
different prefixes so you can see which method as called.
 
  Methods defined here:
msg(self, *args)
nnotice(self, *args)
notice(self, *args)
nreply(self, *args)
pnotice(self, *args)
privmsg(self, *args)
reply = privmsg(self, *args)

Methods inherited from ReplyObject:
__init__(self, **kwargs)
Args: nick, channel (or None), Connection object

 
class IRCReply(ReplyObject)
    This is the class for IRC replies to commands.  Every Command
object has a reply object.  The public methods of this class will
be available as methods of Command instances directly.
 
  Methods defined here:
msg(self, *args)
will _always_ respond privately, even if the command was in
a channel
nnotice(self, *args)
same as nreply, but with notice instead of privmsg
notice(self, *args)
same as reply/privmsg, but sends an irc notice instead.
Some clients handle notices differently from privmsgs, which
may be good or bad :)
nreply(self, *args)
same as reply, but if it's a public response, the user's nick
(the one who typed the command) is prepended
pnotice(self, *args)
like msg, but with a notice
privmsg(self, *args)
default reply mechanism, if multiple args, first is interpreted
as the target (either nick or channel).  Otherwise, reply will
be the same as the command.  That is, a publicly-asked command
will get a public response.
 
the methods reply and privmsg are identical
reply = privmsg(self, *args)

Methods inherited from ReplyObject:
__init__(self, **kwargs)
Args: nick, channel (or None), Connection object

 
class ReplyObject
    Base class for the different reply types.  Mostly, this just
provides the _get_target_and_message method
 
Reply objects are created automatically in CommandHandler._run
 
  Methods defined here:
__init__(self, **kwargs)
Args: nick, channel (or None), Connection object