Skip to content

Commit

Permalink
🐛 修复 SUPERUSER 订阅时误触发订阅申请的问题 (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
Well2333 authored Jun 24, 2024
1 parent d1e663c commit 3de9e68
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
19 changes: 15 additions & 4 deletions nonebot_plugin_bilichat/commands/subs_request.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)


Expand Down
1 change: 0 additions & 1 deletion nonebot_plugin_bilichat/model/const.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "nonebot-plugin-bilichat"

version = "5.10.3"
version = "5.10.4"

description = "多种B站链接解析,视频词云,AI总结,你想要的都在 bilichat"
authors = [
Expand Down

0 comments on commit 3de9e68

Please sign in to comment.