Capabilities¶
Note
I wrote this section with the little knowledge I have of the capabilities system; I work mainly by testing different possibilities until I get what I want. As for all the documentation, feel free to contact me to correct/enhance it.
First, you should know how capabilities work on the user side.
Checking for a capability given its name¶
You only have to use ircdb.checkCapability(prefix, 'capability')
.
You can also override some behavior of the capability system. Here is the
complete documentation of ircdb.checkCapabiltiy
:
- supybot.ircdb.checkCapability(hostmask, capability, users=<supybot.ircdb.UsersDictionary object>, channels=<supybot.ircdb.ChannelsDictionary object>, ignoreOwner=False, ignoreChannelOp=False, ignoreDefaultAllow=False)[source]
Checks that the user specified by name/hostmask has the capability given.
users
andchannels
default toircdb.users
andircdb.channels
.ignoreOwner
,ignoreChannelOp
, andignoreDefaultAllow
are used to override default behavior of the capability system in special cases (actually, in the AutoMode plugin):ignoreOwner
disables the behavior “owners have all capabilites”ignoreChannelOp
disables the behavior “channel ops have all channel capabilities”ignoreDefaultAllow
disables the behavior “if a user does not have a capability or the associated anticapability, then they have the capability”
Manipulating capability names¶
Althrough you can manipulate capability names with string operations, Supybot provides a few methods to do that “in the abstract” (could be useful if we change the capability syntax one day…):
- supybot.ircdb.isCapability(capability)[source]
- supybot.ircdb.makeChannelCapability(channel, capability)[source]
Makes a channel capability given a channel and a capability.
- supybot.ircdb.isChannelCapability(capability)[source]
Returns True if capability is a channel capability; False otherwise.
- supybot.ircdb.makeAntiCapability(capability)[source]
Returns the anticapability of a given capability.
- supybot.ircdb.unAntiCapability(capability)[source]
Takes an anticapability and returns the non-anti form.
- supybot.ircdb.invertCapability(capability)[source]
Make a capability into an anticapability and vice versa.
- supybot.ircdb.isAntiCapability(capability)[source]
Returns True if capability is an anticapability; False otherwise.
- supybot.ircdb.canonicalCapability(capability)[source]