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

def on_message(rule: Rule, priority: int, block: bool) -> Matcher

源代码
def on_message(rule: Rule=empty_rule, priority: int=0, block: bool=False) -> Matcher:
    matcher = Matcher(rule, priority, block)
    for (i, m) in enumerate(_matcher_list):
        if m.priority < matcher.priority:
            _matcher_list.insert(i, matcher)
            break
    else:
        _matcher_list.append(matcher)
    return matcher

def on_keywords(keywords: list[str], rule: Any, priority: int, block: bool) -> 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)

async def on_keywords_rule(event: MessageEvent) -> None

源代码
@Rule
async def on_keywords_rule(event: MessageEvent):
    return any((keyword in event.raw_message for keyword in keywords))

var current_priority = -1

var matcher = Matcher(rule, priority, block)

var current_priority = matcher.priority

`,9),r=[o];function p(i,c){return s(),a("div",null,r)}const u=n(t,[["render",p],["__file","on.html.vue"]]),d=JSON.parse('{"path":"/en/dev/api/message/on.html","title":"liteyuki.message.on","lang":"en-US","frontmatter":{"title":"liteyuki.message.on","order":1,"icon":"laptop-code","category":"API","description":"def on_message(rule: Rule, priority: int, block: bool) -> Matcher 源代码 def on_keywords(keywords: list[str], rule: Any, priority: int, block: bool) -> Matcher 源代码 async def on_key...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/message/on.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/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":"def on_message(rule: Rule, priority: int, block: bool) -> Matcher 源代码 def on_keywords(keywords: list[str], rule: Any, priority: int, block: bool) -> Matcher 源代码 async def on_key..."}],["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-21T09:59:21.000Z"}],["meta",{"property":"article:modified_time","content":"2024-08-21T09:59:21.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.message.on\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-21T09:59:21.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"def on_message(rule: Rule, priority: int, block: bool) -> Matcher","slug":"def-on-message-rule-rule-priority-int-block-bool-matcher","link":"#def-on-message-rule-rule-priority-int-block-bool-matcher","children":[]},{"level":3,"title":"def on_keywords(keywords: list[str], rule: Any, priority: int, block: bool) -> Matcher","slug":"def-on-keywords-keywords-list-str-rule-any-priority-int-block-bool-matcher","link":"#def-on-keywords-keywords-list-str-rule-any-priority-int-block-bool-matcher","children":[]},{"level":3,"title":"async def on_keywords_rule(event: MessageEvent) -> None","slug":"async-def-on-keywords-rule-event-messageevent-none","link":"#async-def-on-keywords-rule-event-messageevent-none","children":[]},{"level":3,"title":"var current_priority = -1","slug":"var-current-priority-1","link":"#var-current-priority-1","children":[]},{"level":3,"title":"var matcher = Matcher(rule, priority, block)","slug":"var-matcher-matcher-rule-priority-block","link":"#var-matcher-matcher-rule-priority-block","children":[]},{"level":3,"title":"var current_priority = matcher.priority","slug":"var-current-priority-matcher-priority","link":"#var-current-priority-matcher-priority","children":[]}],"git":{"createdTime":1724234361000,"updatedTime":1724234361000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":1}]},"readingTime":{"minutes":0.52,"words":157},"filePathRelative":"en/dev/api/message/on.md","localizedDate":"August 21, 2024","autoDesc":true}');export{u as comp,d as data};