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

func add_matcher()

源代码
def add_matcher(matcher: Matcher):
    for (i, m) in enumerate(_matcher_list):
        if m.priority < matcher.priority:
            _matcher_list.insert(i, matcher)
            break
    else:
        _matcher_list.append(matcher)

func on_message(rule: Rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher

源代码
def on_message(rule: Rule=empty_rule, priority: int=0, block: bool=False) -> Matcher:
    matcher = Matcher(rule, priority, block)
    add_matcher(matcher)
    return matcher

func on_keywords(keywords: list[str] = empty_rule, rule = 0, priority: int = False) -> Matcher

源代码
def on_keywords(keywords: list[str], rule=empty_rule, priority: int=0, block: bool=False) -> Matcher:

    @Rule
    async def on_keywords_rule(event: MessageEvent):
        return any((keyword in event.raw_message for keyword in keywords))
    return on_message(on_keywords_rule & rule, priority, block)

var _matcher_list = []

var _queue = Queue()

`,10),p=[o];function l(c,r){return a(),s("div",null,p)}const u=n(t,[["render",l],["__file","on.html.vue"]]),d=JSON.parse('{"path":"/dev/api/message/on.html","title":"liteyuki.message.on","lang":"zh-CN","frontmatter":{"title":"liteyuki.message.on","description":"func add_matcher() 源代码 func on_message(rule: Rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher 源代码 func on_keywords(keywords: list[str] = empty_rule, rule = ...","head":[["link",{"rel":"alternate","hreflang":"en-us","href":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/message/on.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/message/on.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot 轻雪机器人"}],["meta",{"property":"og:title","content":"liteyuki.message.on"}],["meta",{"property":"og:description","content":"func add_matcher() 源代码 func on_message(rule: Rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher 源代码 func on_keywords(keywords: list[str] = empty_rule, rule = ..."}],["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.on\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-29T06:19:39.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"func add_matcher()","slug":"func-add-matcher","link":"#func-add-matcher","children":[]},{"level":3,"title":"func on_message(rule: Rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher","slug":"func-on-message-rule-rule-empty-rule-priority-int-0-block-bool-false-matcher","link":"#func-on-message-rule-rule-empty-rule-priority-int-0-block-bool-false-matcher","children":[]},{"level":3,"title":"func on_keywords(keywords: list[str] = empty_rule, rule = 0, priority: int = False) -> Matcher","slug":"func-on-keywords-keywords-list-str-empty-rule-rule-0-priority-int-false-matcher","link":"#func-on-keywords-keywords-list-str-empty-rule-rule-0-priority-int-false-matcher","children":[]},{"level":3,"title":"var _matcher_list = []","slug":"var-matcher-list","link":"#var-matcher-list","children":[]},{"level":3,"title":"var _queue = Queue()","slug":"var-queue-queue","link":"#var-queue-queue","children":[]}],"git":{"createdTime":1724234361000,"updatedTime":1724912379000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":2}]},"readingTime":{"minutes":0.49,"words":146},"filePathRelative":"dev/api/message/on.md","localizedDate":"2024年8月21日","autoDesc":true}');export{u as comp,d as data};