feat: 支持设置作者别名

1. 新增 mapping_data 配置参数
2. 新增自动更新作者昵称功能

Closes #176
Closes #194
Closes #199
Closes #229
This commit is contained in:
2025-03-22 22:10:17 +08:00
parent f332b3fb2d
commit 3b4f23c670
25 changed files with 618 additions and 307 deletions

View File

@@ -4,6 +4,7 @@ from random import uniform
from rich import print
from rich.text import Text
from ..translation import _
from .static import INFO
@@ -11,7 +12,7 @@ def retry(function):
async def inner(self, *args, **kwargs):
if result := await function(self, *args, **kwargs):
return result
for _ in range(self.retry):
for __ in range(self.retry):
if result := await function(self, *args, **kwargs):
return result
return result
@@ -19,6 +20,23 @@ def retry(function):
return inner
def retry_limited(function):
# TODO: 不支持 TUI
def inner(self, *args, **kwargs):
while True:
if function(self, *args, **kwargs):
return
if self.console.input(
_(
"如需重新尝试处理该对象,请关闭所有正在访问该对象的窗口或程序,然后直接按下回车键!\n"
"如需跳过处理该对象,请输入任意字符后按下回车键!"
),
):
return
return inner
def logging(log, text, style=INFO):
string = Text(text, style=style)
if log:
@@ -31,7 +49,7 @@ def logging(log, text, style=INFO):
async def sleep_time(
min_time: int | float = 0.5,
max_time: int | float = 1.5,
min_time: int | float = 1.0,
max_time: int | float = 2.5,
):
await sleep(uniform(min_time, max_time))