Correctly access bot_settings in Timers.py
This commit is contained in:
parent
fe1b479b2c
commit
c5c2c50bc4
2 changed files with 5 additions and 4 deletions
|
@ -28,7 +28,8 @@ class Timer(object):
|
||||||
return self._done
|
return self._done
|
||||||
|
|
||||||
class Timers(object):
|
class Timers(object):
|
||||||
def __init__(self, events, log):
|
def __init__(self, database, events, log):
|
||||||
|
self.database = database
|
||||||
self.events = events
|
self.events = events
|
||||||
self.log = log
|
self.log = log
|
||||||
self.timers = []
|
self.timers = []
|
||||||
|
@ -40,12 +41,12 @@ class Timers(object):
|
||||||
"next-due"], id, False, timer["kwargs"])
|
"next-due"], id, False, timer["kwargs"])
|
||||||
|
|
||||||
def _persist(self, timer):
|
def _persist(self, timer):
|
||||||
self.set_setting("timer-%s" % timer.id, {
|
self.database.bot_settings.set("timer-%s" % timer.id, {
|
||||||
"name": timer.name, "delay": timer.delay,
|
"name": timer.name, "delay": timer.delay,
|
||||||
"next-due": timer.next_due, "kwargs": timer.kwargs})
|
"next-due": timer.next_due, "kwargs": timer.kwargs})
|
||||||
def _remove(self, timer):
|
def _remove(self, timer):
|
||||||
self.timers.remove(timer)
|
self.timers.remove(timer)
|
||||||
self.del_setting("timer-%s" % timer.id)
|
self.database.bot_settings.delete("timer-%s" % timer.id)
|
||||||
|
|
||||||
def add(self, name, delay, next_due=None, **kwargs):
|
def add(self, name, delay, next_due=None, **kwargs):
|
||||||
self._add(name, delay, next_due, None, False, kwargs)
|
self._add(name, delay, next_due, None, False, kwargs)
|
||||||
|
|
2
start.py
2
start.py
|
@ -35,7 +35,7 @@ config = Config.Config(args.config)
|
||||||
database = Database.Database(log, args.database)
|
database = Database.Database(log, args.database)
|
||||||
events = events = EventManager.EventHook(log)
|
events = events = EventManager.EventHook(log)
|
||||||
exports = exports = Exports.Exports()
|
exports = exports = Exports.Exports()
|
||||||
timers = Timers.Timers(events, log)
|
timers = Timers.Timers(database, events, log)
|
||||||
line_handler = IRCLineHandler.LineHandler(events, timers)
|
line_handler = IRCLineHandler.LineHandler(events, timers)
|
||||||
modules = modules = ModuleManager.ModuleManager(events, exports, config, log,
|
modules = modules = ModuleManager.ModuleManager(events, exports, config, log,
|
||||||
os.path.join(directory, "modules"))
|
os.path.join(directory, "modules"))
|
||||||
|
|
Loading…
Reference in a new issue