import{_ as i,c as a,a7 as t,o as e}from"./chunks/framework.jrU0lkHV.js";const y=JSON.parse('{"title":"liteyuki.session.on","description":"","frontmatter":{"title":"liteyuki.session.on"},"headers":[],"relativePath":"dev/api/session/on.md","filePath":"zh/dev/api/session/on.md","lastUpdated":null}'),n={name:"dev/api/session/on.md"};function l(h,s,r,k,p,o){return e(),a("div",null,s[0]||(s[0]=[t(`

模块 liteyuki.session.on

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

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


func add_matcher(matcher: Matcher)

源代码在GitHub上查看
python
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

源代码在GitHub上查看
python
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], rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher

源代码在GitHub上查看
python
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)
`,12)]))}const c=i(n,[["render",l]]);export{y as __pageData,c as default};