mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 21:29:24 +01:00
Fixed bugs in defaultplugin.
This commit is contained in:
parent
d8bc23d0e4
commit
20e972ec1f
12
src/Owner.py
12
src/Owner.py
@ -401,21 +401,21 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
(command, plugin) = privmsgs.getArgs(rest, optional=1)
|
(command, plugin) = privmsgs.getArgs(rest, optional=1)
|
||||||
command = callbacks.canonicalName(command)
|
command = callbacks.canonicalName(command)
|
||||||
cbs = callbacks.findCallbackForCommand(irc, 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:
|
if remove:
|
||||||
try:
|
try:
|
||||||
conf.supybot.commands.defaultPlugins.unregister(command)
|
conf.supybot.commands.defaultPlugins.unregister(command)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
except registry.NonExistentRegistryEntry:
|
except registry.NonExistentRegistryEntry:
|
||||||
raise callbacks.ArgumentError
|
s = 'I don\'t have a default plugin set for that command.'
|
||||||
|
irc.error(s)
|
||||||
elif not cbs:
|
elif not cbs:
|
||||||
irc.error('That\'s not a valid command.')
|
irc.error('That\'s not a valid command.')
|
||||||
return
|
return
|
||||||
elif plugin:
|
elif plugin:
|
||||||
|
cb = irc.getCallback(plugin)
|
||||||
|
if cb is None:
|
||||||
|
irc.error('That\'s not a valid plugin.')
|
||||||
|
return
|
||||||
registerDefaultPlugin(command, plugin)
|
registerDefaultPlugin(command, plugin)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user