supybot.callbacks¶
Plugin¶
-
class
supybot.callbacks.Plugin(*args, **kwargs)[source]¶ Bases :
supybot.callbacks.PluginMixin,supybot.callbacks.Commands-
Proxy¶ alias de
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)¶ Given a string “command”, dispatches to doCommand.
-
getCommandMethod(command)¶ 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.
-
isCommandMethod(name)¶ Returns whether a given method name is a command in this plugin.
-
name()¶ Returns the name of the callback.
-
outFilter(*args, **kwargs)¶ Used for filtering/modifying messages as they’re leaving.
As with inFilter, an IrcMsg is returned.
-
reset(*args, **kwargs)¶ Resets the callback. Called when reconnecting to the server.
-
PluginRegexp¶
-
class
supybot.callbacks.PluginRegexp(*args, **kwargs)[source]¶ Bases :
supybot.callbacks.PluginSame 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.
-
tokenize¶
Other classes¶
This module contains the basic callbacks for handling PRIVMSGs.
-
exception
supybot.callbacks.ArgumentError[source]¶ Bases :
supybot.callbacks.ErrorThe bot replies with a help message when this is raised.
-
class
supybot.callbacks.CanonicalNameDict(dict=None, key=None)[source]¶ Bases :
supybot.utils.gen.InsensitivePreservingDict
-
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]¶ Bases :
supybot.world.SupyProcessJust does some extra logging and error-recovery for commands that need to run in processes.
-
class
supybot.callbacks.CommandThread(target=None, args=(), kwargs={})[source]¶ Bases :
supybot.world.SupyThreadJust does some extra logging and error-recovery for commands that need to run in threads.
-
run()[source]¶ 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']¶
-
isCommand(*args, **kwargs)¶ Convenience, backwards-compatibility, semi-deprecated.
-
pre_command_callbacks= []¶
-
-
class
supybot.callbacks.Disabled(default, help, setDefault=True, showDefault=True, **kwargs)[source]¶ Bases :
supybot.registry.SpaceSeparatedListOf-
List¶ alias de
CanonicalNameSet
-
Value¶ alias de
CanonicalString
-
sorted= True¶
-
-
exception
supybot.callbacks.Error[source]¶ Bases :
exceptions.ExceptionGeneric class for errors in Privmsg callbacks.
-
supybot.callbacks.IrcObjectProxy¶
-
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.ReplyIrcProxyA proxy object to allow proper nesting of commands (even threaded ones).
-
findCallbacksForArgs(args)[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
- reply.
- 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-
Proxy¶ alias de
NestedCommandsIrcProxy
-
alwaysCall= ()¶
-
classModule= None¶
-
noIgnore= False¶
-
public= True¶
-
threaded= False¶
-
-
supybot.callbacks.Privmsg¶ alias de
supybot.callbacks.Plugin
-
supybot.callbacks.PrivmsgCommandAndRegexp¶ alias de
supybot.callbacks.PluginRegexp
-
class
supybot.callbacks.ReplyIrcProxy(irc, msg)[source]¶ Bases :
supybot.callbacks.RichReplyMethodsThis 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).
-
class
supybot.callbacks.RichReplyMethods[source]¶ Bases :
objectThis 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.
-
exception
supybot.callbacks.SilentError[source]¶ Bases :
supybot.callbacks.ErrorAn error that we should not notify the user.
-
supybot.callbacks.SimpleProxy¶ alias de
supybot.callbacks.ReplyIrcProxy
-
class
supybot.callbacks.Tokenizer(brackets='', pipe=False, quotes='"')[source]¶ Bases :
object-
separators= '\x00\r\n \t'¶
-
-
supybot.callbacks.addressed(nick, 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.