class supybot.callbacks.Plugin(*args, **kwargs)[source]

Bases: supybot.callbacks.PluginMixin, supybot.callbacks.Commands


alias of NestedCommandsIrcProxy

callPrecedence(*args, **kwargs)

Returns a pair of (callbacks to call before me, callbacks to call after me)

die(*args, **kwargs)

Makes the callback die. Called when the parent Irc object dies.

dispatchCommand(command, args=None)

Given a string ‘command’, dispatches to doCommand.


Gets the given command from this plugin.

inFilter(*args, **kwargs)

Used for filtering/modifying messages as they’re entering.

ircmsgs.IrcMsg objects are immutable, so this method is expected to return another ircmsgs.IrcMsg object. Obviously the same IrcMsg can be returned.

isCommand(*args, **kwargs)

Convenience, backwards-compatibility, semi-deprecated.


Returns whether a given method name is a command in this plugin.

outFilter(*args, **kwargs)

Used for filtering/modifying messages as they’re leaving.

As with inFilter, an IrcMsg is returned.

postTransition(*args, **kwargs)

Called when the state of the IRC connection changes.

msg is the message that triggered the transition, if any.

reset(*args, **kwargs)

Resets the callback. Called when reconnecting to the server.


class supybot.callbacks.PluginRegexp(*args, **kwargs)[source]

Bases: supybot.callbacks.Plugin

Same as Plugin, except allows the user to also include regexp-based callbacks. All regexp-based callbacks must be specified in the set (or list) attribute “regexps”, “addressedRegexps”, or “unaddressedRegexps” depending on whether they should always be triggered, triggered only when the bot is addressed, or triggered only when the bot isn’t addressed.

addressedRegexps = ()

‘addressedRegexps’ methods are called only when the message is addressed, and then, only with the payload (i.e., what is returned from the ‘addressed’ function.

regexps = ()

‘regexps’ methods are called whether the message is addressed or not.

unaddressedRegexps = ()

‘unaddressedRegexps’ methods are called only when the message is not addressed.


supybot.callbacks.tokenize(s, channel=None, network=None)[source]

A utility function to create a Tokenizer and tokenize a string.

Other classes

This module contains the basic callbacks for handling PRIVMSGs.

exception supybot.callbacks.ArgumentError[source]

Bases: supybot.callbacks.Error

The bot replies with a help message when this is raised.

class supybot.callbacks.BasePlugin(*args, **kwargs)[source]

Bases: object

class supybot.callbacks.CanonicalNameDict(dict=None, key=None)[source]

Bases: supybot.utils.gen.InsensitivePreservingDict


Override this if you wish.

class supybot.callbacks.CanonicalNameSet(iterable=())[source]

Bases: supybot.utils.gen.NormalizingSet

class supybot.callbacks.CanonicalString(default, *args, **kwargs)[source]

Bases: supybot.registry.NormalizedString

class supybot.callbacks.CommandProcess(target=None, args=(), kwargs={})[source]


Just does some extra logging and error-recovery for commands that need to run in processes.


Method to be run in sub-process; can be overridden in sub-class

class supybot.callbacks.CommandThread(target=None, args=(), kwargs={})[source]


Just does some extra logging and error-recovery for commands that need to run in threads.


Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class supybot.callbacks.Commands(*args, **kwargs)[source]

Bases: supybot.callbacks.BasePlugin, supybot.utils.python.SynchronizedAndFirewalled

callCommand(*args, **kwargs)
commandArgs = ['self', 'irc', 'msg', 'args']
getCommand(args, stripOwnName=True)[source]
getCommandHelp(command, simpleSyntax=None)[source]

Gets the given command from this plugin.

isCommand(*args, **kwargs)

Convenience, backwards-compatibility, semi-deprecated.


Returns whether a given method name is a command in this plugin.

pre_command_callbacks = []
class supybot.callbacks.Disabled(default, help, setDefault=True, showDefault=True, **kwargs)[source]

Bases: supybot.registry.SpaceSeparatedListOf


alias of CanonicalNameSet


alias of CanonicalString

sorted = True
class supybot.callbacks.DisabledCommands[source]

Bases: object

add(command, plugin=None)[source]
disabled(command, plugin=None)[source]
remove(command, plugin=None)[source]
exception supybot.callbacks.Error[source]

Bases: Exception

Generic class for errors in Privmsg callbacks.


alias of supybot.callbacks.NestedCommandsIrcProxy

class supybot.callbacks.MetaSynchronizedAndFirewalled[source]

Bases: supybot.log.MetaFirewall, supybot.utils.python.MetaSynchronized

class supybot.callbacks.NestedCommandsIrcProxy(irc, msg, args, nested=0)[source]

Bases: supybot.callbacks.ReplyIrcProxy

A proxy object to allow proper nesting of commands (even threaded ones).

error(s='', Raise=False, **kwargs)[source]

Returns a two-tuple of (command, plugins) that has the command (a list of strings) and the plugins for which it was a command.

replies(L, prefixer=None, joiner=None, onlyPrefixFirst=False, to=None, oneToOne=None, **kwargs)[source]
reply(s, noLengthCheck=False, prefixNick=None, action=None, private=None, notice=None, to=None, msg=None, sendImmediately=False, stripCtcp=True)[source]

Keyword arguments:

  • noLengthCheck=False: True if the length shouldn’t be checked
    (used for ‘more’ handling)
  • prefixNick=True: False if the nick shouldn’t be prefixed to the
  • action=False: True if the reply should be an action.
  • private=False: True if the reply should be in private.
  • notice=False: True if the reply should be noticed when the
    bot is configured to do so.
  • to=<nick|channel>: The nick or channel the reply should go to.
    Defaults to msg.args[0] (or msg.nick if private)
  • sendImmediately=False: True if the reply should use sendMsg() which
    bypasses conf.supybot.protocols.irc.throttleTime and gets sent before any queued messages
class supybot.callbacks.PluginMixin(irc)[source]

Bases: supybot.callbacks.BasePlugin, supybot.irclib.IrcCallback


alias of NestedCommandsIrcProxy

alwaysCall = ()
classModule = None
noIgnore = False
public = True
registryValue(name, channel=None, network=None, *, value=True)[source]
setRegistryValue(name, value, channel=None, network=None)[source]
setUserValue(name, prefixOrName, value, ignoreNoUser=True, setValue=True)[source]
threaded = False
userValue(name, prefixOrName, default=None)[source]

alias of supybot.callbacks.Plugin


alias of supybot.callbacks.PluginRegexp

class supybot.callbacks.ReplyIrcProxy(irc, msg)[source]

Bases: supybot.callbacks.RichReplyMethods

This class is a thin wrapper around an irclib.Irc object that gives it the reply() and error() methods (as well as everything in RichReplyMethods, based on those two).

error(s, msg=None, **kwargs)[source]

Returns the real irclib.Irc object underlying this proxy chain.

reply(s, msg=None, **kwargs)[source]
class supybot.callbacks.RichReplyMethods[source]

Bases: object

This is a mixin so these replies need only be defined once. It operates under several assumptions, including the fact that ‘self’ is an Irc object of some sort and there is a self.msg that is an IrcMsg.

errorInvalid(what, given=None, s='', repr=True, **kwargs)[source]
errorNoCapability(capability, s='', **kwargs)[source]
errorNoUser(s='', name='that user', **kwargs)[source]
errorNotRegistered(s='', **kwargs)[source]
errorPossibleBug(s='', **kwargs)[source]
errorRequiresPrivacy(s='', **kwargs)[source]
replies(L, prefixer=None, joiner=None, onlyPrefixFirst=False, oneToOne=None, **kwargs)[source]
replyError(s='', **kwargs)[source]
replySuccess(s='', **kwargs)[source]
exception supybot.callbacks.SilentError[source]

Bases: supybot.callbacks.Error

An error that we should not notify the user.


alias of supybot.callbacks.ReplyIrcProxy

class supybot.callbacks.Tokenizer(brackets='', pipe=False, quotes='"')[source]

Bases: object

separators = '\x00\r\n \t'
supybot.callbacks.addressed(irc, msg, **kwargs)[source]

If msg is addressed to ‘name’, returns the portion after the address. Otherwise returns the empty string.

supybot.callbacks.canonicalName(command, preserve_spaces=False)[source]

Turn a command into its canonical form.

Currently, this makes everything lowercase and removes all dashes and underscores.

supybot.callbacks.checkCommandCapability(msg, cb, commandName)[source]
supybot.callbacks.error(*args, **kwargs)[source]
supybot.callbacks.getHelp(method, name=None, doc=None)[source]
supybot.callbacks.getSyntax(method, name=None, doc=None)[source]
supybot.callbacks.reply(*args, **kwargs)[source]