add bot finding abilities

This commit is contained in:
deathbybandaid 2019-05-29 11:54:23 -04:00
parent 3b41f58d90
commit acaa8abe0c

View File

@ -4,8 +4,9 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
This is the SpiceBot Database This is the SpiceBot Database
""" """
from sopel.db import SopelDB # sopel imports
from sopel.tools import Identifier from sopel.tools import Identifier
from sopel.db import SopelDB
import threading import threading
from .Config import config as botconfig from .Config import config as botconfig
@ -16,11 +17,11 @@ class BotDatabase():
def __init__(self): def __init__(self):
self.lock = threading.Lock() self.lock = threading.Lock()
self.db = SopelDB(botconfig.config)
self.dict = { self.dict = {
"nicks": {}, "nicks": {},
"channels": {}, "channels": {},
} }
self.db = SopelDB(botconfig.config)
"""Nick""" """Nick"""
@ -138,6 +139,23 @@ class BotDatabase():
self.lock.release() self.lock.release()
"""Bot"""
def get_bot_value(self, key, sorting_key='unsorted'):
return self.get_nick_value(botconfig.nick, key, sorting_key)
def set_bot_value(self, key, value, sorting_key='unsorted'):
return self.set_nick_value(botconfig.nick, key, value, sorting_key)
def delete_bot_value(self, key, sorting_key='unsorted'):
return self.delete_nick_value(botconfig.nick, key, sorting_key)
def adjust_bot_value(self, key, value, sorting_key='unsorted'):
return self.adjust_nick_value(botconfig.nick, key, value, sorting_key)
def adjust_bot_list(self, key, entries, adjustmentdirection, sorting_key):
return self.adjust_nick_list(botconfig.nick, key, entries, adjustmentdirection, sorting_key)
"""Channels""" """Channels"""
def get_channel_value(self, channel, key, sorting_key='unsorted'): def get_channel_value(self, channel, key, sorting_key='unsorted'):