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

Module liteyuki.session.rule

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

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

var RuleHandlerFunc

class Rule


func __init__(self, handler: RuleHandlerFunc)

Source code or View on GitHub
python
def __init__(self, handler: RuleHandlerFunc):\n    self.handler = handler

func self | other: Rule => Rule

Source code or View on GitHub
python
def __or__(self, other: 'Rule') -> 'Rule':\n\n    async def combined_handler(event: MessageEvent) -> bool:\n        return await self.handler(event) or await other.handler(event)\n    return Rule(combined_handler)

func self & other: Rule => Rule

Source code or View on GitHub
python
def __and__(self, other: 'Rule') -> 'Rule':\n\n    async def combined_handler(event: MessageEvent) -> bool:\n        return await self.handler(event) and await other.handler(event)\n    return Rule(combined_handler)

async func self () event: MessageEvent => bool

Source code or View on GitHub
python
async def __call__(self, event: MessageEvent) -> bool:\n    if self.handler is None:\n        return True\n    return await self.handler(event)

@Rule

async func empty_rule(event: MessageEvent) -> bool

Source code or View on GitHub
python
@Rule\nasync def empty_rule(event: MessageEvent) -> bool:\n    return True

@Rule

async func is_su_rule(event: MessageEvent) -> bool

Source code or View on GitHub
python
@Rule\nasync def is_su_rule(event: MessageEvent) -> bool:\n    return str(event.user_id) in _superusers
',26)]))}const c=i(t,[["render",l]]);export{u as __pageData,c as default};