context: new function to define default data, instead of None
This commit is contained in:
parent
c3c7484792
commit
f520c67c89
1 changed files with 5 additions and 0 deletions
|
@ -40,6 +40,11 @@ class _ModuleContext:
|
|||
def set_knodes(self, knodes):
|
||||
self._knodes = knodes
|
||||
|
||||
def set_default(self, default):
|
||||
# Access to data will trigger the load of data
|
||||
if self.data is None:
|
||||
self._data = default
|
||||
|
||||
def add_hook(self, hook, *triggers):
|
||||
from nemubot.hooks import Abstract as AbstractHook
|
||||
assert isinstance(hook, AbstractHook), hook
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue