📝 add matcher tutorial

This commit is contained in:
yanyongyu
2020-09-22 00:18:57 +08:00
parent 3916cdc244
commit 342d879add
2 changed files with 73 additions and 4 deletions

View File

@ -101,8 +101,7 @@ class Matcher(metaclass=MatcherMeta):
@classmethod
async def check_perm(cls, bot: Bot, event: Event) -> bool:
return (event.type == (cls.type or event.type) and
await cls.permission(bot, event))
return await cls.permission(bot, event)
@classmethod
async def check_rule(cls, bot: Bot, event: Event, state: dict) -> bool:
@ -114,7 +113,8 @@ class Matcher(metaclass=MatcherMeta):
Returns:
bool: 条件成立与否
"""
return await cls.rule(bot, event, state)
return (event.type == (cls.type or event.type) and
await cls.rule(bot, event, state))
@classmethod
def args_parser(cls, func: ArgsParser) -> ArgsParser: