mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-06 04:10:02 +08:00
Update __init__.py
This commit is contained in:
@@ -17,7 +17,7 @@ from utils.utils import is_number, scheduler, get_bot
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
from services.log import logger
|
from services.log import logger
|
||||||
from nonebot import Driver
|
from nonebot import Driver
|
||||||
from nonebot.params import CommandArg, ArgPlainText
|
from nonebot.params import CommandArg, ArgStr
|
||||||
import nonebot
|
import nonebot
|
||||||
|
|
||||||
__zx_plugin_name__ = "B站订阅"
|
__zx_plugin_name__ = "B站订阅"
|
||||||
@@ -112,14 +112,22 @@ async def _(event: MessageEvent, state: T_State, arg: Message = CommandArg()):
|
|||||||
state["id"] = int(id_)
|
state["id"] = int(id_)
|
||||||
|
|
||||||
|
|
||||||
|
@add_sub.got("sub_type")
|
||||||
|
@add_sub.got("sub_user")
|
||||||
@add_sub.got("id")
|
@add_sub.got("id")
|
||||||
async def _(event: MessageEvent, state: T_State, id_: str = ArgPlainText("id")):
|
async def _(
|
||||||
season_data = state["season_data"]
|
event: MessageEvent,
|
||||||
if not is_number(id_) or int(id_) < 1 or int(id_) > len(season_data):
|
state: T_State,
|
||||||
await add_sub.reject_arg("id", "Id必须为数字且在范围内!请重新输入...")
|
id_: str = ArgStr("id"),
|
||||||
id_ = season_data[int(id_) - 1]["media_id"]
|
sub_type: str = ArgStr("sub_type"),
|
||||||
sub_type = state["sub_type"]
|
sub_user: str = ArgStr("sub_user"),
|
||||||
sub_user = state["sub_user"]
|
):
|
||||||
|
if sub_type in ["season", "动漫", "番剧"] and state.get("season_data"):
|
||||||
|
season_data = state["season_data"]
|
||||||
|
if not is_number(id_) or int(id_) < 1 or int(id_) > len(season_data):
|
||||||
|
await add_sub.reject_arg("id", "Id必须为数字且在范围内!请重新输入...")
|
||||||
|
id_ = season_data[int(id_) - 1]["media_id"]
|
||||||
|
id_ = int(id_)
|
||||||
if sub_type in ["主播", "直播"]:
|
if sub_type in ["主播", "直播"]:
|
||||||
await add_sub.send(await add_live_sub(id_, sub_user))
|
await add_sub.send(await add_live_sub(id_, sub_user))
|
||||||
elif sub_type.lower() in ["up", "用户"]:
|
elif sub_type.lower() in ["up", "用户"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user