Menu

Ircdb_object

nanotube

The ircdb object seems to contain information and methods dealing with the registered user database, as well as some convenience methods dealing with capabilities (possibly among other things).

TODO: need to learn more about ircdb

ircdb.users

This is the registered users database.

ircdb.users.getUser()

ircdb.users.getUser(user)

Method to retrieve an object for a particular registered user. user is the username. (TODO: could be some kind of more fancy object - depends on what is in msg.prefix)

Example:

ircdb.users.getUser(msg.prefix)

See also: msg.prefix.

ircdb.checkCapability()

ircdb.checkCapability(user, capability)

This method checks if a particular user has some capability. user is the username (:TODO: could be some kind of more fancy object - depends on what is in msg.prefix). capability is a string denoting the capability.

Example:

capability='admin'
if not ircdb.checkCapability(msg.prefix, capability):
    irc.errorNoCapability(capability, Raise=True)

See also: msg.prefix, irc.errorNoCapability().

ircdb.makeChannelCapability()

ircdb.makeChannelCapability(channel, capability)

This function makes a channel-specific capability out of a regular capability, when given the channel name and the capability string.

It really does nothing more than concatenate the channel name and the capability name with a comma in between. However, it does some sanity checks on the validity of the channel (using ircutils.isChannel()) and capability (using ircdb.isCapability()), so it's a good idea to use this function instead of manually adding strings.

Example:

ircdb.makeChannelCapability('#somechannel','factoids.add')

See also: ircutils.isChannel(), ircdb.isCapability().

ircdb.isCapability()

ircdb.isCapability(capability)

Checks if the capability string is a valid capability. A valid capability cannot contain any interior spaces.

Example:

ircdb.isCapability(" factoids.add ") # returns true
ircdb.isCapability("utilities echo") # returns false

Related

Wiki: Supybot_Resources