Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/core/utils/storedata.py
2023-02-05 22:33:33 +08:00

20 lines
466 B
Python

import ujson as json
from core.types import FetchTarget
from database import BotDBUtil
def get_stored_list(bot: FetchTarget, name):
get = BotDBUtil.Data(bot).get(name=name)
if get is None:
return []
else:
return json.loads(get.value)
def update_stored_list(bot: FetchTarget, name, value):
edit = BotDBUtil.Data(bot).update(name=name, value=json.dumps(value))
return edit
__all__ = ['get_stored_list', 'update_stored_list']