import{_ as n,o as e,c as s,e as a}from"./app-BvUYPzLF.js";const t={},o=a(`

liteyuki.message.matcher

Description: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved

@Time : 2024/8/19 下午10:51 @Author : snowykami @Email : snowykami@outlook.com @File : matcher.py @Software: PyCharm

class Matcher

def __init__(self, rule: Rule, priority: int, block: bool)

Description: 匹配器

Arguments:

Source code or View on GitHub
def __init__(self, rule: Rule, priority: int, block: bool):
    """
        匹配器
        Args:
            rule: 规则
            priority: 优先级 >= 0
            block: 是否阻断后续优先级更低的匹配器
        """
    self.rule = rule
    self.priority = priority
    self.block = block
    self.handlers: list[EventHandler] = []

def handle(self) -> Callable[[EventHandler], EventHandler]

Description: 添加处理函数,装饰器

Return: 装饰器 handler

Source code or View on GitHub
def handle(self) -> Callable[[EventHandler], EventHandler]:
    """
        添加处理函数,装饰器
        Returns:
            装饰器 handler
        """

    def decorator(handler: EventHandler) -> EventHandler:
        self.handlers.append(handler)
        return handler
    return decorator

async def run(self, event: MessageEvent) -> None

Description: 运行处理函数

Arguments:

Source code or View on GitHub
async def run(self, event: MessageEvent) -> None:
    """
        运行处理函数
        Args:
            event:
        Returns:
        """
    if not await self.rule(event):
        return
    for handler in self.handlers:
        try:
            await handler(event)
        except Exception:
            traceback.print_exc()
`,18),i=[o];function l(p,c){return e(),s("div",null,i)}const u=n(t,[["render",l],["__file","matcher.html.vue"]]),d=JSON.parse('{"path":"/en/dev/api/message/matcher.html","title":"liteyuki.message.matcher","lang":"en-US","frontmatter":{"title":"liteyuki.message.matcher","lastUpdated":false,"description":"liteyuki.message.matcher Description: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/8/19 下午10:51 @Author : snowykami @Email : snowykami@outlook.com @F...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/message/matcher.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/message/matcher.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.message.matcher"}],["meta",{"property":"og:description","content":"liteyuki.message.matcher Description: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/8/19 下午10:51 @Author : snowykami @Email : snowykami@outlook.com @F..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-08-29T06:19:39.000Z"}],["meta",{"property":"article:modified_time","content":"2024-08-29T06:19:39.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.message.matcher\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-29T06:19:39.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"class Matcher","slug":"class-matcher","link":"#class-matcher","children":[]}],"git":{"createdTime":1724234361000,"updatedTime":1724912379000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":2}]},"readingTime":{"minutes":0.93,"words":278},"filePathRelative":"en/dev/api/message/matcher.md","localizedDate":"August 21, 2024","autoDesc":true}');export{u as comp,d as data};