plugin: allow plugins to write to other storages
This commit is contained in:
parent
3a85e5a23c
commit
f9dca68fb0
|
@ -105,12 +105,13 @@ class Plugin:
|
|||
ns = self.name
|
||||
return self.bot.storage.get(ns, {}).get(key, default)
|
||||
|
||||
def set_storage_value(self, key, value):
|
||||
def set_storage_value(self, key, value, ns=None):
|
||||
"""Set a value in the plugin persistent storage."""
|
||||
if self.name not in self.bot.storage:
|
||||
self.bot.storage[self.name] = {key: value}
|
||||
name = ns or self.name
|
||||
if name not in self.bot.storage:
|
||||
self.bot.storage[name] = {key: value}
|
||||
else:
|
||||
self.bot.storage[self.name][key] = value
|
||||
self.bot.storage[name][key] = value
|
||||
|
||||
def append_storage_list_value(self, key, value):
|
||||
"""Append a value to a list in the plugin persistent storage."""
|
||||
|
|
Loading…
Reference in a new issue