mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
changes
This commit is contained in:
parent
52cd26e8b1
commit
2e518d3343
@ -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):
|
||||
|
||||
|
||||
@ -38,4 +38,4 @@ class BotConfig():
|
||||
return configdict
|
||||
|
||||
|
||||
db = BotConfig()
|
||||
botconfig = BotConfig()
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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"]
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user