Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Commit

Permalink
Merge pull request #32 from Starry-OvO/develop
Browse files Browse the repository at this point in the history
Update 0.4.2
  • Loading branch information
lumina37 authored Feb 26, 2024
2 parents aaf514c + cde426f commit edf9625
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 35 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/Pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 |

## 友情链接

Expand Down
2 changes: 1 addition & 1 deletion aiotieba_reviewer/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.1"
__version__ = "0.4.2"
4 changes: 2 additions & 2 deletions aiotieba_reviewer/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions aiotieba_reviewer/executor.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion aiotieba_reviewer/imgproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion aiotieba_reviewer/reviewer/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aiotieba_reviewer/reviewer/thread/runner.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion aiotieba_reviewer/reviewer/threads/runner.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion aiotieba_reviewer/reviewer/user_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 10 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -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 |

## 友情链接

Expand Down
8 changes: 6 additions & 2 deletions examples/cmd_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit edf9625

Please sign in to comment.