Give Logging.Log object to modules

This commit is contained in:
jesopo 2018-11-05 12:38:40 +00:00
parent 10130d7288
commit 6ca8017966

View file

@ -23,11 +23,13 @@ class BaseModule(object):
bot: "IRCBot.Bot", bot: "IRCBot.Bot",
events: EventManager.EventHook, events: EventManager.EventHook,
exports: Exports.Exports, exports: Exports.Exports,
timers: Timers.Timers): timers: Timers.Timers,
log: Logging.Log):
self.bot = bot self.bot = bot
self.events = events self.events = events
self.exports = exports self.exports = exports
self.timers = timers self.timers = timers
self.log = log
self.on_load() self.on_load()
def on_load(self): def on_load(self):
pass pass
@ -99,7 +101,7 @@ class ModuleManager(object):
context_exports = self.exports.new_context(context) context_exports = self.exports.new_context(context)
context_timers = self.timers.new_context(context) context_timers = self.timers.new_context(context)
module_object = module.Module(bot, context_events, context_exports, module_object = module.Module(bot, context_events, context_exports,
context_timers) context_timers, self.log)
if not hasattr(module_object, "_name"): if not hasattr(module_object, "_name"):
module_object._name = name.title() module_object._name = name.title()