Try to remove plugin loading race conditions that cause crashes
This commit is contained in:
parent
89a52b1588
commit
6b6a780f76
4
bot.py
4
bot.py
|
@ -8,13 +8,16 @@ PLUGIN_SPECS = dict()
|
|||
class MinerbotPhoenix(teambot.Handler):
|
||||
prefix="!"
|
||||
nick="minerbot"
|
||||
loading=False
|
||||
def on_connection_established(self,*args):
|
||||
self.load_modules()
|
||||
def load_modules(self):
|
||||
self.loading = True
|
||||
plugin.clear()
|
||||
for name in os.listdir("plugins"):
|
||||
if name.endswith(".py"):
|
||||
bot.handler.load_module(name[:-3],os.path.join("plugins",name))
|
||||
self.loading = False
|
||||
def load_module(self,modname,path):
|
||||
try:
|
||||
if modname in PLUGIN_MODULES:
|
||||
|
@ -31,6 +34,7 @@ class MinerbotPhoenix(teambot.Handler):
|
|||
traceback.print_exc()
|
||||
pass
|
||||
def on_pubmsg(self,channel,nick,message):
|
||||
if self.loading: return
|
||||
self.is_admin = self.event.source.userhost == BOTOP
|
||||
for listener in plugin.listeners:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue