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

liteyuki.message.rule

Description: 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

def __init__(self, handler: RuleHandlerFunc)

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

def __or__(self, other: Rule) -> Rule

Source code or View on GitHub
def __or__(self, other: 'Rule') -> 'Rule':

    async def combined_handler(event: MessageEvent) -> bool:
        return await self.handler(event) or await other.handler(event)
    return Rule(combined_handler)

def __and__(self, other: Rule) -> Rule

Source code or View on GitHub
def __and__(self, other: 'Rule') -> 'Rule':

    async def combined_handler(event: MessageEvent) -> bool:
        return await self.handler(event) and await other.handler(event)
    return Rule(combined_handler)

async def __call__(self, event: MessageEvent) -> bool

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

@Rule

async def empty_rule(event: MessageEvent) -> bool

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

@Rule

async def is_su_rule(event: MessageEvent) -> bool

Source code or View on GitHub
@Rule
async def is_su_rule(event: MessageEvent) -> bool:
    return str(event.user_id) in _superusers
`,20),l=[o];function p(i,c){return n(),s("div",null,l)}const u=e(t,[["render",p],["__file","rule.html.vue"]]),d=JSON.parse('{"path":"/en/dev/api/message/rule.html","title":"liteyuki.message.rule","lang":"en-US","frontmatter":{"title":"liteyuki.message.rule","lastUpdated":false,"description":"liteyuki.message.rule Description: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/8/19 下午10:55 @Author : snowykami @Email : snowykami@outlook.com @File...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/message/rule.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/message/rule.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.message.rule"}],["meta",{"property":"og:description","content":"liteyuki.message.rule Description: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/8/19 下午10:55 @Author : snowykami @Email : snowykami@outlook.com @File..."}],["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-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.rule\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-29T06:19:39.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"var RuleHandlerFunc","slug":"var-rulehandlerfunc","link":"#var-rulehandlerfunc","children":[]},{"level":3,"title":"class Rule","slug":"class-rule","link":"#class-rule","children":[]},{"level":3,"title":"async def empty_rule(event: MessageEvent) -> bool","slug":"async-def-empty-rule-event-messageevent-bool","link":"#async-def-empty-rule-event-messageevent-bool","children":[]},{"level":3,"title":"async def is_su_rule(event: MessageEvent) -> bool","slug":"async-def-is-su-rule-event-messageevent-bool","link":"#async-def-is-su-rule-event-messageevent-bool","children":[]}],"git":{"createdTime":1724234361000,"updatedTime":1724912379000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":2}]},"readingTime":{"minutes":1.01,"words":303},"filePathRelative":"en/dev/api/message/rule.md","localizedDate":"August 21, 2024","autoDesc":true}');export{u as comp,d as data};