diff --git a/nonebot_plugin_bilichat/commands/subs_request.py b/nonebot_plugin_bilichat/commands/subs_request.py index 1103513..c570495 100644 --- a/nonebot_plugin_bilichat/commands/subs_request.py +++ b/nonebot_plugin_bilichat/commands/subs_request.py @@ -1,9 +1,9 @@ from asyncio import Lock from typing import TypedDict -from nonebot.adapters import Event, Message +from nonebot.adapters import Bot, Event, Message from nonebot.params import CommandArg, Depends -from nonebot.permission import SUPERUSER +from nonebot.permission import SUPERUSER, Permission from nonebot_plugin_waiter import waiter from ..config import plugin_config @@ -20,8 +20,19 @@ class Request(TypedDict): REQUESTS: dict[User, Request] = {} -bili_add_sub_request = bilichat.command("sub", aliases=set(plugin_config.bilichat_cmd_add_sub), priority=2) -bili_remove_sub_request = bilichat.command("unsub", aliases=set(plugin_config.bilichat_cmd_remove_sub), priority=2) +async def not_superuser(bot: Bot, event: Event) -> bool: + return not await SUPERUSER(bot, event) + + +NOTSUPERUSER: Permission = Permission(not_superuser) + + +bili_add_sub_request = bilichat.command( + "sub", aliases=set(plugin_config.bilichat_cmd_add_sub), priority=2, permission=NOTSUPERUSER +) +bili_remove_sub_request = bilichat.command( + "unsub", aliases=set(plugin_config.bilichat_cmd_remove_sub), priority=2, permission=NOTSUPERUSER +) bili_request_handle = bilichat.command("handle", permission=SUPERUSER) diff --git a/nonebot_plugin_bilichat/model/const.py b/nonebot_plugin_bilichat/model/const.py index 0151f82..19d5c2a 100644 --- a/nonebot_plugin_bilichat/model/const.py +++ b/nonebot_plugin_bilichat/model/const.py @@ -1,6 +1,5 @@ from bilireq.grpc.protos.bilibili.app.dynamic.v2.dynamic_pb2 import DynamicType - DYNAMIC_TYPE_IGNORE = { "DYNAMIC_TYPE_AD", "DYNAMIC_TYPE_LIVE", diff --git a/pyproject.toml b/pyproject.toml index 5eb153e..5053f5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "nonebot-plugin-bilichat" -version = "5.10.3" +version = "5.10.4" description = "多种B站链接解析,视频词云,AI总结,你想要的都在 bilichat" authors = [