diff options
Diffstat (limited to 'ATRI')
-rw-r--r-- | ATRI/database/wrapper.py | 12 | ||||
-rw-r--r-- | ATRI/plugins/thesaurus/__init__.py | 12 |
2 files changed, 16 insertions, 8 deletions
diff --git a/ATRI/database/wrapper.py b/ATRI/database/wrapper.py index 7838bd6..df6057f 100644 --- a/ATRI/database/wrapper.py +++ b/ATRI/database/wrapper.py @@ -6,7 +6,7 @@ from tortoise.models import Model class DatabaseWrapper: def __init__(self, model: Type[Model]): self.model = model - + async def __aenter__(self): return self @@ -15,17 +15,15 @@ class DatabaseWrapper: async def add_sub(self, *args, **kwargs): await self.model.create(*args, **kwargs) - + async def update_sub(self, update_map: dict, **kwargs): - await self.model.filter(**kwargs).update( - **update_map - ) + await self.model.filter(**kwargs).update(**update_map) async def del_sub(self, query_map: dict): await self.model.filter(**query_map).delete() - + async def get_sub_list(self, query_map: dict) -> list: return await self.model.filter(**query_map) - + async def get_all_subs(self) -> list: return await self.model.all() diff --git a/ATRI/plugins/thesaurus/__init__.py b/ATRI/plugins/thesaurus/__init__.py index 0409008..4884801 100644 --- a/ATRI/plugins/thesaurus/__init__.py +++ b/ATRI/plugins/thesaurus/__init__.py @@ -228,7 +228,17 @@ async def _add_global_item( ans = unescape(item_a).split(",,") result = await tm.add_item( - item_id, True, unescape(item_q), ans, need_at, item_t, 0, operator, opeartor_id, 0, list() + item_id, + True, + unescape(item_q), + ans, + need_at, + item_t, + 0, + operator, + opeartor_id, + 0, + list(), ) await add_item_for_global.finish(result) |