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

class Matcher

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

Description: 匹配器

Arguments:

Source code
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] = []

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

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

Return: 装饰器 handler

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

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

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

Description: 运行处理函数

Arguments:

Source code
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()

var EventHandler = Callable[[MessageEvent], Coroutine[None, None, Any]]

`,17),o=[l];function i(p,c){return e(),s("div",null,o)}const u=n(t,[["render",i],["__file","matcher.html.vue"]]),d=JSON.parse('{"path":"/en/api/message/matcher.html","title":"liteyuki.message.matcher","lang":"en-US","frontmatter":{"title":"liteyuki.message.matcher","description":"class Matcher method __init__(self, rule: Rule, priority: int, block: bool) Description: 匹配器 Arguments: rule: 规则 priority: 优先级 >= 0 block: 是否阻断后续优先级更低的匹配器 Source code method han...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/api/message/matcher.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/api/message/matcher.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.message.matcher"}],["meta",{"property":"og:description","content":"class Matcher method __init__(self, rule: Rule, priority: int, block: bool) Description: 匹配器 Arguments: rule: 规则 priority: 优先级 >= 0 block: 是否阻断后续优先级更低的匹配器 Source code method han..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.message.matcher\\",\\"image\\":[\\"\\"],\\"dateModified\\":null,\\"author\\":[]}"]]},"headers":[{"level":3,"title":"class Matcher","slug":"class-matcher","link":"#class-matcher","children":[]},{"level":3,"title":"method __init__(self, rule: Rule, priority: int, block: bool)","slug":"method-init-self-rule-rule-priority-int-block-bool","link":"#method-init-self-rule-rule-priority-int-block-bool","children":[]},{"level":3,"title":"method handle(self) -> Callable[[EventHandler], EventHandler]","slug":"method-handle-self-callable-eventhandler-eventhandler","link":"#method-handle-self-callable-eventhandler-eventhandler","children":[]},{"level":3,"title":"async method run(self, event: MessageEvent) -> None","slug":"async-method-run-self-event-messageevent-none","link":"#async-method-run-self-event-messageevent-none","children":[]},{"level":3,"title":"var EventHandler = Callable[[MessageEvent], Coroutine[None, None, Any]]","slug":"var-eventhandler-callable-messageevent-coroutine-none-none-any","link":"#var-eventhandler-callable-messageevent-coroutine-none-none-any","children":[]}],"git":{"createdTime":null,"updatedTime":null,"contributors":[]},"readingTime":{"minutes":0.75,"words":226},"filePathRelative":"en/api/message/matcher.md","autoDesc":true}');export{u as comp,d as data};