♻️ Refactor (#318)

* 🔧 启用一些 ruff 的新规则

*  添加开发依赖 nonebot-adapter-qq

*  添加依赖 nonebot-plugin-session

*  添加依赖 nonebot-plugin-session-orm

* 🔧 忽略 ruff 规则 ISC001
format 冲突风险

* 🚨 修复 ruff 警报

* ♻️ 重构!

* ♻️ 恢复定时获取 TetraLeague 数据的功能

*  统一处理需要捕获的错误

*  记录用户触发的指令
This commit is contained in:
呵呵です
2024-05-14 15:03:46 +08:00
committed by GitHub
parent e6c3a32532
commit c8832bd1c9
79 changed files with 2629 additions and 2174 deletions

View File

@@ -19,9 +19,8 @@ async def init_templates() -> None:
try:
await create_subprocess_exec('git', '--version', stdout=PIPE)
except FileNotFoundError as e:
raise RuntimeError(
'未找到 git, 请确保 git 已安装并在环境变量中\n安装步骤请参阅: https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git'
) from e
msg = '未找到 git, 请确保 git 已安装并在环境变量中\n安装步骤请参阅: https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git'
raise RuntimeError(msg) from e
if not templates_dir.exists():
logger.info('模板仓库不存在, 正在尝试初始化...')
proc = await create_subprocess_exec(
@@ -39,7 +38,8 @@ async def init_templates() -> None:
if proc.returncode != 0:
for i in stderr.decode().splitlines():
logger.error(i)
raise RuntimeError('初始化模板仓库失败')
msg = '初始化模板仓库失败'
raise RuntimeError(msg)
logger.success('模板仓库初始化成功')
return
proc = await create_subprocess_exec(
@@ -60,7 +60,8 @@ async def init_templates() -> None:
if proc.returncode != 0:
for i in stderr.decode().splitlines():
logger.error(i)
raise RuntimeError('更新模板仓库失败')
msg = '更新模板仓库失败'
raise RuntimeError(msg)
logger.success('模板仓库更新成功')