mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-03 19:00:00 +08:00
数据库中所有user_qq改名以及user_id和group_id改为字符串
This commit is contained in:
@@ -37,12 +37,12 @@ async def _(event: MessageEvent, msg: str = PlaintText()):
|
||||
if isinstance(event, GroupMessageEvent):
|
||||
group_id = str(event.group_id)
|
||||
TEMP_LIST.append(
|
||||
{
|
||||
"user_id": str(event.user_id),
|
||||
"group_id": group_id,
|
||||
"text": str(event.get_message()),
|
||||
"plain_text": msg,
|
||||
}
|
||||
ChatHistory(
|
||||
user_id=str(event.user_id),
|
||||
group_id=group_id,
|
||||
text=str(event.get_message()),
|
||||
plain_text=msg,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ async def _():
|
||||
message_list = TEMP_LIST.copy()
|
||||
TEMP_LIST.clear()
|
||||
if message_list:
|
||||
model_list = [ChatHistory(**x) for x in message_list]
|
||||
await ChatHistory.bulk_create(model_list)
|
||||
await ChatHistory.bulk_create(message_list)
|
||||
logger.debug(f"批量添加聊天记录 {len(message_list)} 条", "定时任务")
|
||||
except Exception as e:
|
||||
logger.error(f"定时批量添加聊天记录", "定时任务", e=e)
|
||||
|
||||
@@ -69,7 +69,7 @@ async def _(event: GroupMessageEvent, reg_group: Tuple[Any, ...] = RegexGroup())
|
||||
num_str = "发言次数:\n\n"
|
||||
idx = 1
|
||||
for uid, num in rank_data:
|
||||
if user := await GroupInfoUser.filter(user_id=str(uid), group_id=str(gid)).first():
|
||||
if user := await GroupInfoUser.filter(user_id=uid, group_id=gid).first():
|
||||
user_name = user.user_name
|
||||
else:
|
||||
user_name = uid
|
||||
|
||||
Reference in New Issue
Block a user