mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Ruff 检查
This commit is contained in:
parent
6d322b0f13
commit
53b8a5397b
@ -251,7 +251,7 @@ class PluginManage:
|
|||||||
)
|
)
|
||||||
group.status = False
|
group.status = False
|
||||||
await group.save(update_fields=["status"])
|
await group.save(update_fields=["status"])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def wake(cls, group_id: str):
|
async def wake(cls, group_id: str):
|
||||||
"""醒来
|
"""醒来
|
||||||
|
|||||||
@ -280,4 +280,4 @@ async def _(bot: Bot, session: Uninfo):
|
|||||||
else:
|
else:
|
||||||
await MessageUtils.build_message("你在做梦吗?你没有昵称啊").finish(
|
await MessageUtils.build_message("你在做梦吗?你没有昵称啊").finish(
|
||||||
reply_to=True
|
reply_to=True
|
||||||
)
|
)
|
||||||
|
|||||||
@ -31,4 +31,4 @@ async def _(session: Uninfo):
|
|||||||
await FriendUser.create(
|
await FriendUser.create(
|
||||||
user_id=session.user.id, platform=PlatformUtils.get_platform(session)
|
user_id=session.user.id, platform=PlatformUtils.get_platform(session)
|
||||||
)
|
)
|
||||||
logger.info("添加当前好友用户信息", "", session=session)
|
logger.info("添加当前好友用户信息", "", session=session)
|
||||||
|
|||||||
@ -48,4 +48,4 @@ __plugin_meta__ = PluginMetadata(
|
|||||||
plugin_type=PluginType.SUPERUSER,
|
plugin_type=PluginType.SUPERUSER,
|
||||||
is_show=False,
|
is_show=False,
|
||||||
).to_dict(),
|
).to_dict(),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -833,4 +833,4 @@ async def _(schedule_id: int):
|
|||||||
f"▫️ 触发规则: {_format_trigger(status)}",
|
f"▫️ 触发规则: {_format_trigger(status)}",
|
||||||
f"▫️ 任务参数: {_format_params(status)}",
|
f"▫️ 任务参数: {_format_params(status)}",
|
||||||
]
|
]
|
||||||
await schedule_cmd.finish("\n".join(info_lines))
|
await schedule_cmd.finish("\n".join(info_lines))
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class BotConsole(Model):
|
|||||||
class Meta: # pyright: ignore [reportIncompatibleVariableOverride]
|
class Meta: # pyright: ignore [reportIncompatibleVariableOverride]
|
||||||
table = "bot_console"
|
table = "bot_console"
|
||||||
table_description = "Bot数据表"
|
table_description = "Bot数据表"
|
||||||
|
|
||||||
cache_type = CacheType.BOT
|
cache_type = CacheType.BOT
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class PluginInfo(Model):
|
|||||||
class Meta: # pyright: ignore [reportIncompatibleVariableOverride]
|
class Meta: # pyright: ignore [reportIncompatibleVariableOverride]
|
||||||
table = "plugin_info"
|
table = "plugin_info"
|
||||||
table_description = "插件基本信息"
|
table_description = "插件基本信息"
|
||||||
|
|
||||||
cache_type = CacheType.PLUGINS
|
cache_type = CacheType.PLUGINS
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@ -35,4 +35,4 @@ class ScheduleInfo(Model):
|
|||||||
|
|
||||||
class Meta: # pyright: ignore [reportIncompatibleVariableOverride]
|
class Meta: # pyright: ignore [reportIncompatibleVariableOverride]
|
||||||
table = "schedule_info"
|
table = "schedule_info"
|
||||||
table_description = "通用定时任务表"
|
table_description = "通用定时任务表"
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class Model(TortoiseModel):
|
|||||||
Model_: Model
|
Model_: Model
|
||||||
"""
|
"""
|
||||||
sem_data: ClassVar[dict[str, dict[str, Semaphore]]] = {}
|
sem_data: ClassVar[dict[str, dict[str, Semaphore]]] = {}
|
||||||
|
|
||||||
def __init_subclass__(cls, **kwargs):
|
def __init_subclass__(cls, **kwargs):
|
||||||
if cls.__module__ not in MODELS:
|
if cls.__module__ not in MODELS:
|
||||||
MODELS.append(cls.__module__)
|
MODELS.append(cls.__module__)
|
||||||
|
|||||||
@ -91,4 +91,4 @@ class AsyncPlaywright:
|
|||||||
if card:
|
if card:
|
||||||
await card.screenshot(path=path, timeout=timeout, type=type_)
|
await card.screenshot(path=path, timeout=timeout, type=type_)
|
||||||
return MessageUtils.build_message(path)
|
return MessageUtils.build_message(path)
|
||||||
return None
|
return None
|
||||||
|
|||||||
@ -223,4 +223,4 @@ class Retry:
|
|||||||
|
|
||||||
return sync_wrapper
|
return sync_wrapper
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class CacheType(StrEnum):
|
|||||||
"""用户权限"""
|
"""用户权限"""
|
||||||
LIMIT = "GLOBAL_LIMIT"
|
LIMIT = "GLOBAL_LIMIT"
|
||||||
"""插件限制"""
|
"""插件限制"""
|
||||||
|
|
||||||
class BankHandleType(StrEnum):
|
class BankHandleType(StrEnum):
|
||||||
DEPOSIT = "DEPOSIT"
|
DEPOSIT = "DEPOSIT"
|
||||||
"""存款"""
|
"""存款"""
|
||||||
|
|||||||
@ -83,4 +83,4 @@ class AllURIsFailedError(Exception):
|
|||||||
f" - {url}: {exc.__class__.__name__}({exc})"
|
f" - {url}: {exc.__class__.__name__}({exc})"
|
||||||
for url, exc in zip(self.urls, self.exceptions)
|
for url, exc in zip(self.urls, self.exceptions)
|
||||||
)
|
)
|
||||||
return f"All {len(self.urls)} URIs failed:\n{exc_info}"
|
return f"All {len(self.urls)} URIs failed:\n{exc_info}"
|
||||||
|
|||||||
@ -691,4 +691,4 @@ class AsyncHttpx:
|
|||||||
httpx.AsyncClient: 一个配置好的、临时的客户端实例。
|
httpx.AsyncClient: 一个配置好的、临时的客户端实例。
|
||||||
"""
|
"""
|
||||||
async with get_async_client(**kwargs) as client:
|
async with get_async_client(**kwargs) as client:
|
||||||
yield client
|
yield client
|
||||||
|
|||||||
@ -807,4 +807,4 @@ async def _load_schedules_from_db():
|
|||||||
count += 1
|
count += 1
|
||||||
else:
|
else:
|
||||||
logger.warning(f"跳过加载定时任务:插件 '{schedule.plugin_name}' 未注册。")
|
logger.warning(f"跳过加载定时任务:插件 '{schedule.plugin_name}' 未注册。")
|
||||||
logger.info(f"定时任务加载完成,共成功加载 {count} 个任务。")
|
logger.info(f"定时任务加载完成,共成功加载 {count} 个任务。")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user