mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
修复首次安装时词条旧表出错
This commit is contained in:
parent
afc05e1731
commit
82fe59e469
@ -252,6 +252,8 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
|
|||||||
|
|
||||||
### 感谢名单
|
### 感谢名单
|
||||||
(可以告诉我你的 __github__ 地址,我偷偷换掉0v|)
|
(可以告诉我你的 __github__ 地址,我偷偷换掉0v|)
|
||||||
|
[爱发电用户_4jrf](https://afdian.net/u/6b2cdcc817c611ed949152540025c377)
|
||||||
|
[爱发电用户_TBsd](https://afdian.net/u/db638b60217911ed9efd52540025c377)
|
||||||
[烟寒若雨](https://afdian.net/u/067bd2161eec11eda62b52540025c377)
|
[烟寒若雨](https://afdian.net/u/067bd2161eec11eda62b52540025c377)
|
||||||
[ln](https://afdian.net/u/b51914ba1c6611ed8a4e52540025c377)
|
[ln](https://afdian.net/u/b51914ba1c6611ed8a4e52540025c377)
|
||||||
[爱发电用户_b9S4](https://afdian.net/u/3d8f30581a2911edba6d52540025c377)
|
[爱发电用户_b9S4](https://afdian.net/u/3d8f30581a2911edba6d52540025c377)
|
||||||
@ -277,6 +279,7 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
|
|||||||
|
|
||||||
### 2022/8/22
|
### 2022/8/22
|
||||||
|
|
||||||
|
* 修复首次安装时词条旧表出错(因为根本就没有这张表!)
|
||||||
* 对米游社cookie进行判断,整合米游社签到信息 [@pull/1014](https://github.com/HibiKier/zhenxun_bot/pull/1014)
|
* 对米游社cookie进行判断,整合米游社签到信息 [@pull/1014](https://github.com/HibiKier/zhenxun_bot/pull/1014)
|
||||||
* 修正尘歌壶和质变仪图片获取地址 [@pull/1010](https://github.com/HibiKier/zhenxun_bot/pull/1010)
|
* 修正尘歌壶和质变仪图片获取地址 [@pull/1010](https://github.com/HibiKier/zhenxun_bot/pull/1010)
|
||||||
* 修复词库问答 **很多** 问题[@pull/1012](https://github.com/HibiKier/zhenxun_bot/pull/1012)
|
* 修复词库问答 **很多** 问题[@pull/1012](https://github.com/HibiKier/zhenxun_bot/pull/1012)
|
||||||
@ -793,7 +796,7 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
|
|||||||
__..... 更多更新信息请查看文档__
|
__..... 更多更新信息请查看文档__
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
- [ ] web管理
|
- [x] web管理
|
||||||
|
|
||||||
## 感谢
|
## 感谢
|
||||||
[botuniverse / onebot](https://github.com/botuniverse/onebot) :超棒的机器人协议
|
[botuniverse / onebot](https://github.com/botuniverse/onebot) :超棒的机器人协议
|
||||||
|
|||||||
@ -187,20 +187,23 @@ async def _():
|
|||||||
if await WordBank.get_group_all_problem(0):
|
if await WordBank.get_group_all_problem(0):
|
||||||
return
|
return
|
||||||
logger.info('开始迁移词条 纯文本 数据')
|
logger.info('开始迁移词条 纯文本 数据')
|
||||||
word_list = await OldWordBank.get_all()
|
try:
|
||||||
for word in word_list:
|
word_list = await OldWordBank.get_all()
|
||||||
problem: str = word.problem
|
for word in word_list:
|
||||||
user_id = word.user_qq
|
problem: str = word.problem
|
||||||
group_id = word.group_id
|
user_id = word.user_qq
|
||||||
format_ = word.format
|
group_id = word.group_id
|
||||||
answer = word.answer
|
format_ = word.format
|
||||||
# 仅对纯文本做处理
|
answer = word.answer
|
||||||
if '[CQ' not in problem and '[CQ' not in answer and '[_to_me' not in problem:
|
# 仅对纯文本做处理
|
||||||
if not format_:
|
if '[CQ' not in problem and '[CQ' not in answer and '[_to_me' not in problem:
|
||||||
await WordBank.add_problem_answer(user_id, group_id, 1, 0, problem, answer)
|
if not format_:
|
||||||
await WordBank.add_problem_answer(0, 0, 999, 0, '_[OK', '_[OK')
|
await WordBank.add_problem_answer(user_id, group_id, 1, 0, problem, answer)
|
||||||
logger.info('词条 纯文本 数据迁移完成')
|
await WordBank.add_problem_answer(0, 0, 999, 0, '_[OK', '_[OK')
|
||||||
(Path() / 'plugins' / 'word_bank' / '_old_model.py').unlink()
|
logger.info('词条 纯文本 数据迁移完成')
|
||||||
|
(Path() / 'plugins' / 'word_bank' / '_old_model.py').unlink()
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f'迁移词条发生错误,如果为首次安装请无视 {type(e)}:{e}')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,4 +23,4 @@ async def _(event: MessageEvent, state: T_State):
|
|||||||
f"(USER {event.user_id}, GROUP "
|
f"(USER {event.user_id}, GROUP "
|
||||||
f"{event.group_id if isinstance(event, GroupMessageEvent) else 'private'})"
|
f"{event.group_id if isinstance(event, GroupMessageEvent) else 'private'})"
|
||||||
f" 触发词条 {problem}"
|
f" 触发词条 {problem}"
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user