mirror of https://github.com/Mikaela/Limnoria.git
Make Owner.defaultplugin more robust in it's error detection.
This commit is contained in:
parent
b9598abfb8
commit
45b534fa03
12
src/Owner.py
12
src/Owner.py
|
@ -393,9 +393,17 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
(command, plugin) = privmsgs.getArgs(rest, optional=1)
|
||||
command = callbacks.canonicalName(command)
|
||||
cbs = callbacks.findCallbackForCommand(irc, command)
|
||||
def isDispatcher(cb):
|
||||
name = callbacks.canonicalName(getattr(cb, 'name')())
|
||||
return getattr(cb, name).isDispatcher
|
||||
# Ensure someone isn't trying to use a plugin for their command
|
||||
cbs = [cb for cb in cbs if not isDispatcher(cb)]
|
||||
if remove:
|
||||
conf.supybot.commands.defaultPlugins.unregister(command)
|
||||
irc.replySuccess()
|
||||
try:
|
||||
conf.supybot.commands.defaultPlugins.unregister(command)
|
||||
irc.replySuccess()
|
||||
except registry.NonExistentRegistryEntry:
|
||||
raise callbacks.ArgumentError
|
||||
elif not cbs:
|
||||
irc.error('That\'s not a valid command.')
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue