Skip to content

Commit

Permalink
[🚀]bump version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benx1n committed Aug 29, 2023
1 parent f3ca110 commit 850c512
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def main(bot, ev: CQEvent):
_nlmt.increase(qqid)
superuser_command_list = ['添加监控', '删除监控']
for each in superuser_command_list:
if each in str(ev.message) and qqid not in hoshino.config.SUPERUSERS:
if each in str(ev.message) and int(qqid) not in config['listen_admin']:
await bot.send(ev, '请联系机器人搭建者添加权限')
return
hikari = await init_hikari(platform='QQ', PlatformId=str(ev['user_id']), command_text=str(ev.message), GroupId=group_id)
Expand Down
3 changes: 2 additions & 1 deletion config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"ocr_offline":false,
"ocr_url":"http://ocr.benx1n.com:23338",
"http2":true,
"browser":"chromium"
"browser":"chromium",
"listen_admin":[1119809439,2622749113]
}
5 changes: 5 additions & 0 deletions game/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import httpx
import orjson
from httpx import TimeoutException
from loguru import logger

from ..data_source import config
Expand Down Expand Up @@ -51,6 +52,9 @@ async def pic2txt_byOCR(img_path, filename):
if result['code'] == 200:
logger.success(f"OCR结果:{result['data']['msg']},耗时{end-start:.4f}s\n图片url:{img_path}")
return result['data']['msg']
except TimeoutException:
logger.error('ocr超时,请确认OCR服务是否在线')
return ''
except Exception:
logger.error(traceback.format_exc())
return ''
Expand Down Expand Up @@ -86,6 +90,7 @@ async def downlod_OcrResult():
# ocr_filename_data = json.load(open(ocr_data_path, 'r', encoding='utf8'))
return
except Exception:
logger.error('请检查token是否配置正确,如无问题请尝试重启,可能是网络波动或服务器原因')
with open(ocr_data_path, 'rb') as f:
ocr_filename_data = orjson.loads(f.read())
# ocr_filename_data = json.load(open(ocr_data_path, 'r', encoding='utf8'))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ beautifulsoup4==4.11.1
loguru==0.6.0
paho-mqtt==1.6.1
orjson~=3.8.11
hikari-core~=0.9.0
hikari-core~=1.0.0

0 comments on commit 850c512

Please sign in to comment.