diff --git a/sopel_modules/SpiceBot/Commands.py b/sopel_modules/SpiceBot/Commands.py index ba8a456..368e80c 100644 --- a/sopel_modules/SpiceBot/Commands.py +++ b/sopel_modules/SpiceBot/Commands.py @@ -12,7 +12,7 @@ import threading import spicemanip from .Logs import logs -from .Database import db as spicedb +from .Database import botdb class BotCommands(): @@ -39,7 +39,7 @@ class BotCommands(): def get_disabled_commands(self, bot, channel): if not len(list(self.dict['disabled'])): - self.dict['disabled'] = spicedb.get_channel_value(bot, channel, 'disabled_commands', 'commands') or {} + self.dict['disabled'] = botdb.get_channel_value(bot, channel, 'disabled_commands', 'commands') or {} return self.dict['disabled'] def check_disabled_commands(self, bot, command, channel): @@ -64,16 +64,16 @@ class BotCommands(): def set_command_disabled(self, bot, command, channel, timestamp, reason, bywhom): if not len(list(self.dict['disabled'])): - self.dict['disabled'] = spicedb.get_channel_value(bot, channel, 'disabled_commands', 'commands') or {} + self.dict['disabled'] = botdb.get_channel_value(bot, channel, 'disabled_commands', 'commands') or {} self.dict['disabled'][command] = {"reason": reason, "timestamp": timestamp, "disabledby": bywhom} - spicedb.set_channel_value(bot, channel, 'disabled_commands', self.dict['disabled'], 'commands') + botdb.set_channel_value(bot, channel, 'disabled_commands', self.dict['disabled'], 'commands') def unset_command_disabled(self, bot, command, channel): if not len(list(self.dict['disabled'])): - self.dict['disabled'] = spicedb.get_channel_value(bot, channel, 'disabled_commands', 'commands') or {} + self.dict['disabled'] = botdb.get_channel_value(bot, channel, 'disabled_commands', 'commands') or {} if command in self.dict['disabled'].keys(): del self.dict['disabled'][command] - spicedb.set_channel_value(bot, channel, 'disabled_commands', self.dict['disabled'], 'commands') + botdb.set_channel_value(bot, channel, 'disabled_commands', self.dict['disabled'], 'commands') def register(self, bot, command_dict): diff --git a/sopel_modules/SpiceBot/Config.py b/sopel_modules/SpiceBot/Config.py index 9c35d9d..0245fea 100644 --- a/sopel_modules/SpiceBot/Config.py +++ b/sopel_modules/SpiceBot/Config.py @@ -38,4 +38,4 @@ class BotConfig(): return configdict -db = BotConfig() +botconfig = BotConfig() diff --git a/sopel_modules/SpiceBot/Database.py b/sopel_modules/SpiceBot/Database.py index c03364d..d5424e6 100644 --- a/sopel_modules/SpiceBot/Database.py +++ b/sopel_modules/SpiceBot/Database.py @@ -14,6 +14,7 @@ class BotDatabase(): def __init__(self): self.lock = threading.Lock() + self.db = None self.dict = { "nicks": {}, "channels": {}, @@ -246,4 +247,4 @@ class BotDatabase(): self.lock.release() -db = BotDatabase() +botdb = BotDatabase() diff --git a/sopel_modules/SpiceBot/Events.py b/sopel_modules/SpiceBot/Events.py index b228352..a6e1e5b 100644 --- a/sopel_modules/SpiceBot/Events.py +++ b/sopel_modules/SpiceBot/Events.py @@ -14,6 +14,10 @@ import threading from .Logs import logs +# TODO +# full_message = ':{} PRIVMSG {} :{}'.format(hostmask, sender, msg) + + class BotEvents(object): """A dynamic listing of all the notable Bot numeric events. diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 8cea340..6f4a137 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -13,7 +13,7 @@ import spicemanip from .Tools import command_permissions_check from .Commands import commands -from .Database import db as spicedb +from .Database import botdb class BotPrerun(): @@ -106,7 +106,7 @@ class BotPrerun(): # don't run commands that are disabled in channels if not trigger.is_privmsg: - disabled_list = spicedb.get_channel_value(bot, trigger.sender, 'disabled_commands', 'commands') or {} + disabled_list = botdb.get_channel_value(bot, trigger.sender, 'disabled_commands', 'commands') or {} if trigger.sb["realcom"] in disabled_list.keys(): reason = disabled_list[trigger.sb["realcom"]]["reason"] timestamp = disabled_list[trigger.sb["realcom"]]["timestamp"] diff --git a/sopel_modules/SpiceBot_Database_Addons/Databaseaddons.py b/sopel_modules/SpiceBot_Database_Addons/Databaseaddons.py index 8cf4cb7..1d919e5 100644 --- a/sopel_modules/SpiceBot_Database_Addons/Databaseaddons.py +++ b/sopel_modules/SpiceBot_Database_Addons/Databaseaddons.py @@ -30,13 +30,12 @@ def setup(bot): SopelDB.delete_channel_value = SopelDBAddon.delete_channel_value SopelDB.adjust_channel_value = SopelDBAddon.adjust_channel_value - SopelDB.adjust_plugin_value = SopelDBAddon.adjust_plugin_value - SopelDB.delete_plugin_value = SopelDBAddon.delete_plugin_value SopelDB.get_plugin_value = SopelDBAddon.get_plugin_value SopelDB.set_plugin_value = SopelDBAddon.set_plugin_value + SopelDB.delete_plugin_value = SopelDBAddon.delete_plugin_value + SopelDB.adjust_plugin_value = SopelDBAddon.adjust_plugin_value -# TODO use this as a template for dynamic tablenames class PluginValues(BASE): """ PluginValues SQLAlchemy Class