supybot.irclib¶
Irc¶
It is usually the irc object given to plugin commands.
-
class
supybot.irclib.Irc(network, callbacks=[])[source]¶ Bases :
supybot.irclib.IrcCommandDispatcher,supybot.log.FirewalledThe base class for an IRC connection.
Handles PING commands already.
-
zombie¶ Whether or not this object represents a living IRC connection.
Type: bool
-
network¶ The name of the network this object is connected to.
Type: str
-
startedAt¶ Type: float
-
addCallback(callback)[source]¶ Adds a callback to the callbacks list.
Paramètres: callback (supybot.irclib.IrcCallback) – A callback object
-
die(*args, **kwargs)¶ Makes the Irc object promise to die – but it won’t die (of its own volition) until all its queues are clear. Isn’t that cool?
-
dispatchCommand(command)¶ Given a string “command”, dispatches to doCommand.
-
feedMsg(*args, **kwargs)¶ Called by the IrcDriver; feeds a message received.
-
isChannel(s)[source]¶ Helper function to check whether a given string is a channel on the network this Irc object is connected to.
-
monitor(targets)[source]¶ Increment a counter of how many callbacks monitor each target; and send a MONITOR + to the server if the target is not yet monitored.
-
takeMsg(*args, **kwargs)¶ Called by the IrcDriver; takes a message to be sent.
-
IrcState¶
Used mainly as the state attribute of supybot.irclib.Irc objects.
-
class
supybot.irclib.IrcState(history=None, supported=None, nicksToHostmasks=None, channels=None, capabilities_ack=None, capabilities_nak=None, capabilities_ls=None)[source]¶ Bases :
supybot.irclib.IrcCommandDispatcher,supybot.log.FirewalledMaintains state of the Irc connection. Should also become smarter.
-
addMsg(*args, **kwargs)¶ Updates the state based on the irc object and the message.
-
dispatchCommand(command)¶ Given a string “command”, dispatches to doCommand.
-
ChannelState¶
Used mainly as the channels[“#chan”] attribute of
supybot.irclib.Irc objects.
Other classes¶
-
class
supybot.irclib.Batch(type, arguments, messages)¶ Bases :
tuple-
arguments¶ Alias for field number 1
-
messages¶ Alias for field number 2
-
type¶ Alias for field number 0
-
-
class
supybot.irclib.IrcCallback(*args, **kwargs)[source]¶ Bases :
supybot.irclib.IrcCommandDispatcher,supybot.log.FirewalledBase class for standard callbacks.
Callbacks derived from this class should have methods of the form « doCommand » – doPrivmsg, doNick, do433, etc. These will be called on matching messages.
-
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.
-
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.
-
name(*args, **kwargs)¶ 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.
-
-
class
supybot.irclib.IrcCommandDispatcher[source]¶ Bases :
objectBase class for classes that must dispatch on a command.
-
class
supybot.irclib.IrcMsgQueue(iterable=())[source]¶ Bases :
objectClass for a queue of IrcMsgs. Eventually, it should be smart.
Probably smarter than it is now, though it’s gotten quite a bit smarter than it originally was. A method to « score » methods, and a heapq to maintain a priority queue of the messages would be the ideal way to do intelligent queuing.
As it stands, however, we simply keep track of “high priority” messages, “low priority” messages, and normal messages, and just make sure to return the “high priority” ones before the normal ones before the “low priority” ones.