Skip to content

Commit

Permalink
fix: batch_upload keyerr
Browse files Browse the repository at this point in the history
  • Loading branch information
RongRongJi committed Apr 2, 2023
1 parent 8d29882 commit 4845be1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ nonebot.load_plugins("src/plugins", "nonebot_plugin_quote")
- 增加了是否需要at机器人的选项
- 增加了指令前缀

### v0.3.3 (2023/4/2)
### v0.3.4 (2023/4/2)

- 增加批量上传语录功能(试验版)

Expand Down
4 changes: 2 additions & 2 deletions nonebot_plugin_quote/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,14 @@ async def script_batch_handle(bot: Bot, event: Event, state: T_State):
idx += 1
msg_id = await bot.send_msg(group_id=int(groupNum), message='[CQ:image,file={}]'.format(save_file))
time.sleep(2)
if save_file in forward_index[group_id[0]]:
if group_id[0] in forward_index and save_file in forward_index[group_id[0]]:
await bot.send_msg(group_id=int(groupNum), message='上述图片已存在')
continue
try:
ocr = await bot.ocr_image(image=imgid)
ocr_content = handle_ocr_text(ocr['texts'])
except exception.ActionFailed:
await bot.send_msg(group_id=int(groupNum), message='该图片ocr失败')
await bot.send_msg(group_id=int(groupNum), message='该图片ocr失败, 请单独上传')
continue

time.sleep(1)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-plugin-quote"
version = "0.3.3"
version = "0.3.4"
description = "一款适用于QQ群聊天的语录库插件"
authors = ["RongRongJi <316315867@qq.com>"]
license = "MIT"
Expand Down

0 comments on commit 4845be1

Please sign in to comment.