mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Added special handling to make sure reloading Misc doesn't kill MoobotFactoids.
This commit is contained in:
parent
be97120c63
commit
0769c0a586
@ -64,6 +64,13 @@ def replyWhenNotCommand(irc, msg, notCommands):
|
|||||||
utils.commaAndify(notCommands)
|
utils.commaAndify(notCommands)
|
||||||
irc.reply(msg, s)
|
irc.reply(msg, s)
|
||||||
|
|
||||||
|
def reload(x=None):
|
||||||
|
"""Called when this plugin is reloaded."""
|
||||||
|
global replyWhenNotCommand
|
||||||
|
if x is None:
|
||||||
|
return replyWhenNotCommand
|
||||||
|
else:
|
||||||
|
replyWhenNotCommand = x
|
||||||
|
|
||||||
class Misc(callbacks.Privmsg):
|
class Misc(callbacks.Privmsg):
|
||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
|
@ -321,8 +321,13 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
name = privmsgs.getArgs(args)
|
name = privmsgs.getArgs(args)
|
||||||
callbacks = irc.removeCallback(name)
|
callbacks = irc.removeCallback(name)
|
||||||
if callbacks:
|
if callbacks:
|
||||||
|
module = sys.modules[callbacks[0].__module__]
|
||||||
|
if hasattr(module, 'reload'):
|
||||||
|
x = module.reload()
|
||||||
try:
|
try:
|
||||||
module = loadPluginModule(name)
|
module = loadPluginModule(name)
|
||||||
|
if hasattr(module, 'reload'):
|
||||||
|
module.reload(x)
|
||||||
for callback in callbacks:
|
for callback in callbacks:
|
||||||
callback.die()
|
callback.die()
|
||||||
del callback
|
del callback
|
||||||
|
Loading…
Reference in New Issue
Block a user