mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-05 11:49:59 +08:00
⚡️ 代码优化与修复
This commit is contained in:
@@ -50,7 +50,7 @@ __plugin_meta__ = PluginMetadata(
|
||||
碧蓝航线/碧蓝[重型/轻型/特型/活动][1-300]抽: 碧蓝航线重型/轻型/特型/活动卡池
|
||||
fgo[1-300]抽: fgo卡池 (已失效)
|
||||
阴阳师[1-300]抽: 阴阳师卡池
|
||||
ba/碧蓝档案[1-200]抽:碧蓝档案卡池 (已失效)
|
||||
ba/碧蓝档案[1-200]抽:碧蓝档案卡池
|
||||
* 以上指令可以通过 XX一井 来指定最大抽取数量 *
|
||||
* 示例:原神一井 *
|
||||
""".strip(),
|
||||
|
||||
@@ -7,7 +7,7 @@ from nonebot_plugin_saa import Image, MessageFactory, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.config import Config
|
||||
from zhenxun.configs.path_config import IMAGE_PATH, TEMP_PATH
|
||||
from zhenxun.configs.path_config import TEMP_PATH
|
||||
from zhenxun.configs.utils import PluginExtraData
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.http_utils import AsyncHttpx
|
||||
@@ -34,7 +34,7 @@ headers = {
|
||||
}
|
||||
|
||||
_matcher = on_alconna(
|
||||
Alconna("p搜", Args["pid", int]), aliases={"P搜"}, priority=5, block=True
|
||||
Alconna("p搜", Args["pid", str]), aliases={"P搜"}, priority=5, block=True
|
||||
)
|
||||
|
||||
|
||||
@@ -44,11 +44,13 @@ async def _(pid: Match[int]):
|
||||
_matcher.set_path_arg("pid", pid.result)
|
||||
|
||||
|
||||
@_matcher.got_path("pid", prompt="需要查询的图片PID是?")
|
||||
async def _(bot: Bot, session: EventSession, arparma: Arparma, pid: int):
|
||||
@_matcher.got_path("pid", prompt="需要查询的图片PID是?或发送'取消'结束搜索")
|
||||
async def _(bot: Bot, session: EventSession, arparma: Arparma, pid: str):
|
||||
url = Config.get_config("hibiapi", "HIBIAPI") + "/api/pixiv/illust"
|
||||
if pid in ["取消", "算了"]:
|
||||
await Text("已取消操作...").finish()
|
||||
if not pid.isdigit():
|
||||
await Text("pid必须为数字...").finish()
|
||||
for _ in range(3):
|
||||
try:
|
||||
data = (
|
||||
@@ -61,6 +63,12 @@ async def _(bot: Bot, session: EventSession, arparma: Arparma, pid: int):
|
||||
except TimeoutError:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"pixiv pid 搜索发生了一些错误...",
|
||||
arparma.header_result,
|
||||
session=session,
|
||||
e=e,
|
||||
)
|
||||
await Text(f"发生了一些错误..{type(e)}:{e}").finish()
|
||||
else:
|
||||
if data.get("error"):
|
||||
|
||||
@@ -185,11 +185,12 @@ class RussianManage:
|
||||
return MessageFactory(message_list)
|
||||
|
||||
async def accept(
|
||||
self, group_id: str, user_id: str, uname: str
|
||||
self, bot: Bot, group_id: str, user_id: str, uname: str
|
||||
) -> Text | MessageFactory:
|
||||
"""接受对决
|
||||
|
||||
参数:
|
||||
bot: Bot
|
||||
group_id: 群组id
|
||||
user_id: 用户id
|
||||
uname: 用户名称
|
||||
@@ -209,6 +210,7 @@ class RussianManage:
|
||||
return Text("你没有足够的钱来接受这场挑战...")
|
||||
russian.player2 = (user_id, uname)
|
||||
russian.next_user = russian.player1[0]
|
||||
self.__build_job(bot, group_id, True)
|
||||
return MessageFactory(
|
||||
[
|
||||
Text("决斗已经开始!请"),
|
||||
|
||||
@@ -28,7 +28,7 @@ async def login_get_token(form_data: OAuth2PasswordRequestForm = Depends()):
|
||||
password = Config.get_config("web-ui", "password")
|
||||
if not username or not password:
|
||||
return Result.fail("你滴配置文件里用户名密码配置项为空", 998)
|
||||
if username != form_data.username or password != form_data.password:
|
||||
if username != form_data.username or str(password) != form_data.password:
|
||||
return Result.fail("真笨, 账号密码都能记错!", 999)
|
||||
user = get_user(form_data.username)
|
||||
if not user:
|
||||
|
||||
Reference in New Issue
Block a user