From c11dba117aedd92726ba0d32b283c509d99e51db Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 27 Aug 2004 05:00:40 +0000 Subject: [PATCH] Added defaultcapability command. --- src/Owner.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Owner.py b/src/Owner.py index 89a3a0ceb..068705a29 100644 --- a/src/Owner.py +++ b/src/Owner.py @@ -662,6 +662,33 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): except AttributeError: # There's a cleaner way to do this, but I'm lazy. irc.error('I couldn\'t reconnect. You should restart me instead.') + def defaultcapability(self, irc, msg, args): + """ + + Adds or removes (according to the first argument) from the + default capabilities given to users (the configuration variable + supybot.capabilities stores these). + """ + (action, capability) = privmsgs.getArgs(args, required=2) + if action == 'add': + conf.supybot.capabilities().add(capability) + irc.replySuccess() + elif action == 'remove': + try: + conf.supybot.capabilities().remove(capability) + irc.replySuccess() + except KeyError: + if ircdb.isAntiCapability(capability): + irc.error('That capability wasn\'t in ' + 'supybot.capabilities.') + else: + anticap = ircdb.makeAntiCapability(capability) + conf.supybot.capabilities().add(anticap) + irc.replySuccess() + else: + irc.error('That\'s not a valid action to take. Valid actions ' + 'are "add" and "remove"') + def disable(self, irc, msg, args): """[]