mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
char_history新增_run_script
This commit is contained in:
parent
73f858e071
commit
e41f3a4ce7
13
README.md
13
README.md
@ -331,11 +331,16 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
|
||||
|
||||
## 更新
|
||||
|
||||
### 2022/2/19
|
||||
### 2023/2/20
|
||||
|
||||
* chat_history部分字段调整为可null [@pull/1270](https://github.com/HibiKier/zhenxun_bot/pull/1270)
|
||||
|
||||
### 2023/2/19
|
||||
|
||||
* 修正了`重载插件`的帮助提示
|
||||
* 修改BUG
|
||||
|
||||
### 2022/2/18
|
||||
### 2023/2/18
|
||||
|
||||
* 数据库舍弃`gino`使用`tortoise`
|
||||
* 昵称提供命令`全局昵称设置`
|
||||
@ -344,11 +349,11 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
|
||||
* 解决开红包经常误触的问题,有红包和未领取的时候才会触发“开”命令 [@pull/1257](https://github.com/HibiKier/zhenxun_bot/pull/1257)
|
||||
* 细节优化,原神今日素材重写 [@pull/1258](https://github.com/HibiKier/zhenxun_bot/pull/1258)
|
||||
|
||||
### 2022/1/31
|
||||
### 2023/1/31
|
||||
|
||||
* 修复B站转发卡片BUG [@pull/1249](https://github.com/HibiKier/zhenxun_bot/pull/1249)
|
||||
|
||||
### 2022/1/27
|
||||
### 2023/1/27
|
||||
|
||||
* 替换pixiv反向代理地址 [@pull/1244](https://github.com/HibiKier/zhenxun_bot/pull/1244)
|
||||
|
||||
|
||||
@ -315,9 +315,9 @@ async def update_member_info(group_id: int, remind_superuser: bool = False) -> b
|
||||
)
|
||||
if str(user_info["user_id"]) in bot.config.superusers:
|
||||
await LevelUser.set_level(user_info["user_id"], user_info["group_id"], 9)
|
||||
user = await GroupInfoUser.filter(
|
||||
user = await GroupInfoUser.get_or_none(
|
||||
user_qq=user_info["user_id"], group_id=user_info["group_id"]
|
||||
).first()
|
||||
)
|
||||
if user:
|
||||
if user.user_name != nickname:
|
||||
user.user_name=nickname
|
||||
|
||||
@ -50,7 +50,7 @@ class ChatHistory(Model):
|
||||
.group_by("user_qq")
|
||||
.limit(limit)
|
||||
.values_list("user_qq", "count")
|
||||
)
|
||||
) # type: ignore
|
||||
|
||||
@classmethod
|
||||
async def get_group_first_msg_datetime(cls, group_id: int) -> Optional[datetime]:
|
||||
@ -103,4 +103,13 @@ class ChatHistory(Model):
|
||||
)
|
||||
elif isinstance(days, tuple):
|
||||
query = query.filter(create_at__range=days)
|
||||
return await query.all()
|
||||
return await query.all() # type: ignore
|
||||
|
||||
@classmethod
|
||||
async def _run_script(cls):
|
||||
await cls.raw("alter table chat_history alter group_id drop not null;")
|
||||
"""允许 group_id 为空"""
|
||||
await cls.raw("alter table chat_history alter text drop not null;")
|
||||
"""允许 text 为空"""
|
||||
await cls.raw("alter table chat_history alter plain_text drop not null;")
|
||||
"""允许 plain_text 为空"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user