mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +01:00
Make sure getCommandMethod only returns a valid command method
In situations like an alias, simply using getattr(self, command[0]) may return a class method instead of the alias (think "Alias add die ...").
This commit is contained in:
parent
62897a9663
commit
0b6926826a
@ -1135,7 +1135,13 @@ class Commands(BasePlugin):
|
||||
assert command[0] == self.canonicalName()
|
||||
return self.getCommandMethod(command[1:])
|
||||
else:
|
||||
return getattr(self, command[0])
|
||||
method = getattr(self, command[0])
|
||||
if inspect.ismethod(method):
|
||||
code = method.im_func.func_code
|
||||
if inspect.getargs(code)[0] == self.commandArgs:
|
||||
return method
|
||||
else:
|
||||
raise AttributeError
|
||||
|
||||
def listCommands(self):
|
||||
commands = []
|
||||
|
Loading…
Reference in New Issue
Block a user