mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-01 01:25:07 +08:00
🐛 change USER perm and temp matcher type
This commit is contained in:
parent
eb330c3260
commit
853b797cd9
@ -526,7 +526,7 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
except RejectedException:
|
except RejectedException:
|
||||||
self.handlers.insert(0, handler) # type: ignore
|
self.handlers.insert(0, handler) # type: ignore
|
||||||
Matcher.new(
|
Matcher.new(
|
||||||
self.type,
|
"message",
|
||||||
Rule(),
|
Rule(),
|
||||||
USER(event.get_session_id(),
|
USER(event.get_session_id(),
|
||||||
perm=self.permission), # type:ignore
|
perm=self.permission), # type:ignore
|
||||||
@ -539,7 +539,7 @@ class Matcher(metaclass=MatcherMeta):
|
|||||||
expire_time=datetime.now() + bot.config.session_expire_timeout)
|
expire_time=datetime.now() + bot.config.session_expire_timeout)
|
||||||
except PausedException:
|
except PausedException:
|
||||||
Matcher.new(
|
Matcher.new(
|
||||||
self.type,
|
"message",
|
||||||
Rule(),
|
Rule(),
|
||||||
USER(event.get_session_id(),
|
USER(event.get_session_id(),
|
||||||
perm=self.permission), # type:ignore
|
perm=self.permission), # type:ignore
|
||||||
|
@ -127,8 +127,7 @@ def USER(*user: str, perm: Permission = Permission()):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
async def _user(bot: "Bot", event: "Event") -> bool:
|
async def _user(bot: "Bot", event: "Event") -> bool:
|
||||||
return event.get_type() == "message" and event.get_session_id(
|
return event.get_session_id() in user and await perm(bot, event)
|
||||||
) in user and await perm(bot, event)
|
|
||||||
|
|
||||||
return Permission(_user)
|
return Permission(_user)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user