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

class Matcher

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

说明: 匹配器

参数:

源代码
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]

说明: 添加处理函数,装饰器

返回: 装饰器 handler

源代码
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

说明: 运行处理函数

参数:

源代码
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(),a("div",null,o)}const d=n(t,[["render",i],["__file","matcher.html.vue"]]),u=JSON.parse('{"path":"/dev/api/message/matcher.html","title":"liteyuki.message.matcher","lang":"zh-CN","frontmatter":{"title":"liteyuki.message.matcher","description":"class Matcher method __init__(self, rule: Rule, priority: int, block: bool) 说明: 匹配器 参数: rule: 规则 priority: 优先级 >= 0 block: 是否阻断后续优先级更低的匹配器 源代码 method handle(self) -> Callable[[E...","head":[["link",{"rel":"alternate","hreflang":"en-us","href":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/message/matcher.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/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":"class Matcher method __init__(self, rule: Rule, priority: int, block: bool) 说明: 匹配器 参数: rule: 规则 priority: 优先级 >= 0 block: 是否阻断后续优先级更低的匹配器 源代码 method handle(self) -> Callable[[E..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:locale:alternate","content":"en-US"}],["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":[]},{"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":1724234361000,"updatedTime":1724912379000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":2}]},"readingTime":{"minutes":0.79,"words":236},"filePathRelative":"dev/api/message/matcher.md","localizedDate":"2024年8月21日","autoDesc":true}');export{d as comp,u as data};