mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Added a check for the already-presence of an attribute.
This commit is contained in:
parent
2bd7a31c27
commit
da7e93a283
@ -641,6 +641,10 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
s = '%s is not a valid command in the %s plugin.' % (name, plugin)
|
s = '%s is not a valid command in the %s plugin.' % (name, plugin)
|
||||||
irc.error(s)
|
irc.error(s)
|
||||||
return
|
return
|
||||||
|
if hasattr(cb, name):
|
||||||
|
irc.error('The %s plugin already has an attribute named %s.' %
|
||||||
|
(plugin, name))
|
||||||
|
return
|
||||||
method = getattr(cb.__class__, command)
|
method = getattr(cb.__class__, command)
|
||||||
setattr(cb.__class__, name, method)
|
setattr(cb.__class__, name, method)
|
||||||
delattr(cb.__class__, command)
|
delattr(cb.__class__, command)
|
||||||
|
Loading…
Reference in New Issue
Block a user