From 6445f20296f21bea6e1f202a284af40b0b58f86a Mon Sep 17 00:00:00 2001 From: Starry-OvO Date: Sat, 24 Feb 2024 01:04:31 +0800 Subject: [PATCH 1/4] chore: update readme --- README.md | 21 ++++++++++----------- docs/index.md | 21 ++++++++++----------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index db115e4..97b89fd 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,18 @@ ## 客户名单 -*2024.01.01更新* +*2024.02.24更新* | 吧名 | 关注量 | 浏览量(30天平均) | 发帖量 | | :------- | :-----: | :----------------: | :----: | -| 抗压背锅 | 5393279 | 1102620 | 65661 | -| 孙笑川 | 5167570 | 515134 | 165882 | -| 原神内鬼 | 679134 | 459588 | 30564 | -| 憨批 | 62735 | 110510 | 34856 | -| lol半价 | 2097339 | 84087 | 3534 | -| 新孙笑川 | 934713 | 18560 | 8291 | -| 宫漫 | 1658293 | 13807 | 1056 | -| vtuber | 230820 | 12602 | 784 | -| 天堂鸡汤 | 392221 | 7696 | 1785 | -| 元气骑士 | 282885 | 5718 | 503 | +| 抗压背锅 | 5431520 | 844029 | 43940 | +| 孙笑川 | 5383418 | 478024 | 144280 | +| 原神内鬼 | 691513 | 375507 | 21945 | +| 憨批 | 72992 | 157823 | 47995 | +| lol半价 | 2099998 | 88680 | 3882 | +| 新孙笑川 | 971561 | 21052 | 7381 | +| vtuber | 232164 | 15166 | 682 | +| 元气骑士 | 284171 | 7691 | 941 | +| 天堂鸡汤 | 396197 | 6785 | 1626 | ## 友情链接 diff --git a/docs/index.md b/docs/index.md index db115e4..97b89fd 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,19 +1,18 @@ ## 客户名单 -*2024.01.01更新* +*2024.02.24更新* | 吧名 | 关注量 | 浏览量(30天平均) | 发帖量 | | :------- | :-----: | :----------------: | :----: | -| 抗压背锅 | 5393279 | 1102620 | 65661 | -| 孙笑川 | 5167570 | 515134 | 165882 | -| 原神内鬼 | 679134 | 459588 | 30564 | -| 憨批 | 62735 | 110510 | 34856 | -| lol半价 | 2097339 | 84087 | 3534 | -| 新孙笑川 | 934713 | 18560 | 8291 | -| 宫漫 | 1658293 | 13807 | 1056 | -| vtuber | 230820 | 12602 | 784 | -| 天堂鸡汤 | 392221 | 7696 | 1785 | -| 元气骑士 | 282885 | 5718 | 503 | +| 抗压背锅 | 5431520 | 844029 | 43940 | +| 孙笑川 | 5383418 | 478024 | 144280 | +| 原神内鬼 | 691513 | 375507 | 21945 | +| 憨批 | 72992 | 157823 | 47995 | +| lol半价 | 2099998 | 88680 | 3882 | +| 新孙笑川 | 971561 | 21052 | 7381 | +| vtuber | 232164 | 15166 | 682 | +| 元气骑士 | 284171 | 7691 | 941 | +| 天堂鸡汤 | 396197 | 6785 | 1626 | ## 友情链接 From 62b2329d807f6ddd939c591671d4e7c4c2831c1d Mon Sep 17 00:00:00 2001 From: Starry-OvO Date: Sat, 24 Feb 2024 13:57:06 +0800 Subject: [PATCH 2/4] feat: executor supporting block90 --- aiotieba_reviewer/__version__.py | 2 +- aiotieba_reviewer/database.py | 2 +- aiotieba_reviewer/executor.py | 11 +++++++++-- aiotieba_reviewer/imgproc.py | 2 +- aiotieba_reviewer/reviewer/entry.py | 2 +- aiotieba_reviewer/reviewer/thread/runner.py | 2 +- aiotieba_reviewer/reviewer/threads/runner.py | 2 +- aiotieba_reviewer/reviewer/user_checker.py | 2 +- examples/cmd_handler.py | 8 ++++++-- 9 files changed, 22 insertions(+), 11 deletions(-) diff --git a/aiotieba_reviewer/__version__.py b/aiotieba_reviewer/__version__.py index 3d26edf..28f6fd2 100644 --- a/aiotieba_reviewer/__version__.py +++ b/aiotieba_reviewer/__version__.py @@ -1 +1 @@ -__version__ = "0.4.1" +__version__ = "0.4.2a0" diff --git a/aiotieba_reviewer/database.py b/aiotieba_reviewer/database.py index 67f489e..c5416b8 100644 --- a/aiotieba_reviewer/database.py +++ b/aiotieba_reviewer/database.py @@ -6,7 +6,7 @@ from typing import Any, Callable, Final, List, Optional, Tuple, Union import aiomysql -from aiotieba.logging import get_logger as LOG +from aiotieba import get_logger as LOG from aiotieba.typing import UserInfo from .config import DB_CONFIG diff --git a/aiotieba_reviewer/executor.py b/aiotieba_reviewer/executor.py index 9f392a3..b59c619 100644 --- a/aiotieba_reviewer/executor.py +++ b/aiotieba_reviewer/executor.py @@ -1,6 +1,7 @@ from typing import Awaitable, Callable, Optional -from aiotieba.logging import get_logger as LOG +import aiotieba as tb +from aiotieba import get_logger as LOG from .client import get_client, get_fname from .enums import Ops @@ -12,7 +13,13 @@ async def default_punish_executor(punish: Punish) -> Optional[Punish]: if day := punish.day: client = await get_client() - await client.block(get_fname(), punish.obj.user.portrait, day=day, reason=punish.note) + ret = await client.block(get_fname(), punish.obj.user.portrait, day=day, reason=punish.note) + if isinstance(ret.err, tb.exception.TiebaServerError): + if ret.err.code == 1211068: + await client.unblock(get_fname(), punish.obj.user.user_id) + await client.block(get_fname(), punish.obj.user.portrait, day=day, reason=punish.note) + elif ret.err.code == 3150003: + await client.block(get_fname(), punish.obj.user.portrait, day=10, reason=punish.note) op = punish.op if op == Ops.NORMAL: diff --git a/aiotieba_reviewer/imgproc.py b/aiotieba_reviewer/imgproc.py index e969b75..38603ac 100644 --- a/aiotieba_reviewer/imgproc.py +++ b/aiotieba_reviewer/imgproc.py @@ -2,7 +2,7 @@ import cv2 as cv import numpy as np -from aiotieba.logging import get_logger as LOG +from aiotieba import get_logger as LOG from .client import get_db diff --git a/aiotieba_reviewer/reviewer/entry.py b/aiotieba_reviewer/reviewer/entry.py index 4566b5c..51bd9f7 100644 --- a/aiotieba_reviewer/reviewer/entry.py +++ b/aiotieba_reviewer/reviewer/entry.py @@ -3,7 +3,7 @@ from typing import Generator, List, NoReturn, Optional from aiotieba.enums import PostSortType -from aiotieba.logging import get_logger as LOG +from aiotieba import get_logger as LOG from .. import client, executor from ..client import get_client diff --git a/aiotieba_reviewer/reviewer/thread/runner.py b/aiotieba_reviewer/reviewer/thread/runner.py index 5603fd3..0b920b6 100644 --- a/aiotieba_reviewer/reviewer/thread/runner.py +++ b/aiotieba_reviewer/reviewer/thread/runner.py @@ -1,6 +1,6 @@ from typing import Awaitable, Callable -from aiotieba.logging import get_logger as LOG +from aiotieba import get_logger as LOG from ... import executor from ...perf_stat import aperf_stat diff --git a/aiotieba_reviewer/reviewer/threads/runner.py b/aiotieba_reviewer/reviewer/threads/runner.py index 839c10e..1ae5fd8 100644 --- a/aiotieba_reviewer/reviewer/threads/runner.py +++ b/aiotieba_reviewer/reviewer/threads/runner.py @@ -1,7 +1,7 @@ import asyncio from typing import Awaitable, Callable -from aiotieba.logging import get_logger as LOG +from aiotieba import get_logger as LOG from ... import executor from ...perf_stat import aperf_stat diff --git a/aiotieba_reviewer/reviewer/user_checker.py b/aiotieba_reviewer/reviewer/user_checker.py index a04e2a4..affe8a1 100644 --- a/aiotieba_reviewer/reviewer/user_checker.py +++ b/aiotieba_reviewer/reviewer/user_checker.py @@ -17,7 +17,7 @@ async def _(obj: TypeObj) -> Optional[Punish]: db = await get_db() permission = await db.get_user_id(obj.user.user_id) if permission <= -5: - return Punish(obj, Ops.DELETE, 10, "黑名单") + return Punish(obj, Ops.DELETE, 90, "黑名单") if permission >= 1: return Punish(obj, Ops.NORMAL) return await func(obj) diff --git a/examples/cmd_handler.py b/examples/cmd_handler.py index b0c82cc..b9236e3 100644 --- a/examples/cmd_handler.py +++ b/examples/cmd_handler.py @@ -413,8 +413,12 @@ async def cmd_block(self, ctx: Context) -> None: note = ctx.args[1] if len(ctx.args) > 1 else ctx.note success = await ctx.admin.block(ctx.fname, user.portrait, day=day, reason=note) - if isinstance(success.err, tb.exception.TiebaServerError) and success.err.code == 3150003: - success = await ctx.admin.block(ctx.fname, user.portrait, day=10, reason=note) + if isinstance(success.err, tb.exception.TiebaServerError): + if success.err.code == 3150003: + success = await ctx.admin.block(ctx.fname, user.portrait, day=10, reason=note) + elif success.err.code == 1211068: + await ctx.admin.unblock(ctx.fname, user.user_id) + success = await ctx.admin.block(ctx.fname, user.portrait, day=10, reason=note) if success: await ctx.admin.del_post(ctx.fname, ctx.tid, ctx.pid) From 426af989128f8f82a4af36934119088a7e0cf78e Mon Sep 17 00:00:00 2001 From: Starry-OvO Date: Mon, 26 Feb 2024 18:43:07 +0800 Subject: [PATCH 3/4] chore: update CI --- .github/workflows/Pages.yml | 4 +++- aiotieba_reviewer/database.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Pages.yml b/.github/workflows/Pages.yml index 6d0e072..5b4b6e7 100644 --- a/.github/workflows/Pages.yml +++ b/.github/workflows/Pages.yml @@ -24,9 +24,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup PDM + uses: pdm-project/setup-pdm@v4 + - name: Install dependencies run: | - pipx install pdm pdm install -G doc --no-default - name: Build diff --git a/aiotieba_reviewer/database.py b/aiotieba_reviewer/database.py index c5416b8..0d8f2e9 100644 --- a/aiotieba_reviewer/database.py +++ b/aiotieba_reviewer/database.py @@ -28,7 +28,7 @@ async def wrapper(self: "MySQLDB", *args, **kwargs): except aiomysql.Error as err: try: code = err.args[0] - if code == 2003: + if code in [2003, 1049]: LOG().warning("无法连接数据库 将尝试自动建库") await self.create_database() await create_table_func(self) From cde426feb9002f97c1274766d9502b6b99053b47 Mon Sep 17 00:00:00 2001 From: Starry-OvO Date: Mon, 26 Feb 2024 19:11:30 +0800 Subject: [PATCH 4/4] chore: bump version to 0.4.2 --- aiotieba_reviewer/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiotieba_reviewer/__version__.py b/aiotieba_reviewer/__version__.py index 28f6fd2..df12433 100644 --- a/aiotieba_reviewer/__version__.py +++ b/aiotieba_reviewer/__version__.py @@ -1 +1 @@ -__version__ = "0.4.2a0" +__version__ = "0.4.2"