mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-07-27 19:10:55 +00:00
✨ 插件管理添加翻页按钮,支持从内存快速获取当前session状态
This commit is contained in:
@ -57,6 +57,7 @@ class Database:
|
||||
"""
|
||||
table_name = model.TABLE_NAME
|
||||
model_type = type(model)
|
||||
nonebot.logger.debug(f"Selecting {model_type} WHERE {condition} {args}")
|
||||
if not table_name:
|
||||
raise ValueError(f"数据模型{model_type.__name__}未提供表名")
|
||||
|
||||
@ -85,6 +86,7 @@ class Database:
|
||||
"""
|
||||
table_list = [item[0] for item in self.cursor.execute("SELECT name FROM sqlite_master WHERE type='table'").fetchall()]
|
||||
for model in args:
|
||||
nonebot.logger.debug(f"Upserting {model}")
|
||||
if not model.TABLE_NAME:
|
||||
raise ValueError(f"数据模型 {model.__class__.__name__} 未提供表名")
|
||||
elif model.TABLE_NAME not in table_list:
|
||||
@ -164,13 +166,9 @@ class Database:
|
||||
return new_obj
|
||||
elif isinstance(obj, (list, set, tuple)):
|
||||
|
||||
print(" - Load as List")
|
||||
|
||||
new_obj = []
|
||||
for item in obj:
|
||||
|
||||
print(" - Loading Item", item)
|
||||
|
||||
if isinstance(item, bytes):
|
||||
|
||||
# 对bytes进行尝试解析,解析失败则返回原始bytes
|
||||
@ -179,8 +177,6 @@ class Database:
|
||||
except Exception as e:
|
||||
new_obj.append(self._load(item))
|
||||
|
||||
print(" - Load as Bytes | Result:", new_obj[-1])
|
||||
|
||||
elif isinstance(item, str) and item.startswith(self.FOREIGN_KEY_PREFIX):
|
||||
new_obj.append(self._load(self._get_foreign_data(item)))
|
||||
else:
|
||||
@ -202,6 +198,7 @@ class Database:
|
||||
|
||||
"""
|
||||
table_name = model.TABLE_NAME
|
||||
nonebot.logger.debug(f"Deleting {model} WHERE {condition} {args}")
|
||||
if not table_name:
|
||||
raise ValueError(f"数据模型{model.__class__.__name__}未提供表名")
|
||||
if model.id is not None:
|
||||
|
Reference in New Issue
Block a user