Merge pull request #15 from importantchoice/fix-reload
Fix issue #14 - remove plugins on reloadpull/13/head^2
commit
2d1472c739
|
@ -2,6 +2,7 @@ import imp
|
||||||
import os
|
import os
|
||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
|
import pinhook.plugin
|
||||||
|
|
||||||
import irc.bot
|
import irc.bot
|
||||||
|
|
||||||
|
@ -48,6 +49,8 @@ class Bot(irc.bot.SingleServerIRCBot):
|
||||||
setattr(self, a, kwarguments[a])
|
setattr(self, a, kwarguments[a])
|
||||||
|
|
||||||
def load_plugins(self):
|
def load_plugins(self):
|
||||||
|
# clear plugin list to ensure no old plugins remain
|
||||||
|
pinhook.plugin.clear_plugins()
|
||||||
# ensure plugin folder exists
|
# ensure plugin folder exists
|
||||||
if not os.path.exists(self.plugin_dir):
|
if not os.path.exists(self.plugin_dir):
|
||||||
os.makedirs(self.plugin_dir)
|
os.makedirs(self.plugin_dir)
|
||||||
|
|
|
@ -21,6 +21,10 @@ def add_plugin(command, func):
|
||||||
cmds.append({'cmd': command, 'func': func})
|
cmds.append({'cmd': command, 'func': func})
|
||||||
|
|
||||||
|
|
||||||
|
def clear_plugins():
|
||||||
|
cmds.clear()
|
||||||
|
|
||||||
|
|
||||||
def register(command):
|
def register(command):
|
||||||
def register_for_command(func):
|
def register_for_command(func):
|
||||||
add_plugin(command, func)
|
add_plugin(command, func)
|
||||||
|
|
Loading…
Reference in New Issue