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

@Rule

async func empty_rule() -> bool

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

@Rule

async func is_su_rule() -> bool

Source code
@Rule
async def is_su_rule(event: MessageEvent) -> bool:
    return str(event.user_id) in _superusers

class Rule

method __init__(self, handler: RuleHandlerFunc)

Source code
def __init__(self, handler: RuleHandlerFunc):
    self.handler = handler

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

Source code
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)

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

Source code
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 method __call__(self, event: MessageEvent) -> bool

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

var _superusers = get_config('liteyuki.superusers', [])

var RuleHandlerFunc = Callable[[MessageEvent], Coroutine[None, None, bool]]

`,19),o=[l];function c(p,r){return n(),s("div",null,o)}const i=e(t,[["render",c],["__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","description":"@Rule async func empty_rule() -> bool Source code @Rule async func is_su_rule() -> bool Source code class Rule method __init__(self, handler: RuleHandlerFunc) Source code method...","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":"@Rule async func empty_rule() -> bool Source code @Rule async func is_su_rule() -> bool Source code class Rule method __init__(self, handler: RuleHandlerFunc) Source code method..."}],["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":"@Rule","slug":"rule","link":"#rule","children":[]},{"level":3,"title":"async func empty_rule() -> bool","slug":"async-func-empty-rule-bool","link":"#async-func-empty-rule-bool","children":[]},{"level":3,"title":"@Rule","slug":"rule-1","link":"#rule-1","children":[]},{"level":3,"title":"async func is_su_rule() -> bool","slug":"async-func-is-su-rule-bool","link":"#async-func-is-su-rule-bool","children":[]},{"level":3,"title":"class Rule","slug":"class-rule","link":"#class-rule","children":[]},{"level":3,"title":"method __init__(self, handler: RuleHandlerFunc)","slug":"method-init-self-handler-rulehandlerfunc","link":"#method-init-self-handler-rulehandlerfunc","children":[]},{"level":3,"title":"method __or__(self, other: Rule) -> Rule","slug":"method-or-self-other-rule-rule","link":"#method-or-self-other-rule-rule","children":[]},{"level":3,"title":"method __and__(self, other: Rule) -> Rule","slug":"method-and-self-other-rule-rule","link":"#method-and-self-other-rule-rule","children":[]},{"level":3,"title":"async method __call__(self, event: MessageEvent) -> bool","slug":"async-method-call-self-event-messageevent-bool","link":"#async-method-call-self-event-messageevent-bool","children":[]},{"level":3,"title":"var _superusers = get_config('liteyuki.superusers', [])","slug":"var-superusers-get-config-liteyuki-superusers","link":"#var-superusers-get-config-liteyuki-superusers","children":[]},{"level":3,"title":"var RuleHandlerFunc = Callable[[MessageEvent], Coroutine[None, None, bool]]","slug":"var-rulehandlerfunc-callable-messageevent-coroutine-none-none-bool","link":"#var-rulehandlerfunc-callable-messageevent-coroutine-none-none-bool","children":[]}],"git":{"createdTime":1724234361000,"updatedTime":1724912379000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":2}]},"readingTime":{"minutes":0.69,"words":207},"filePathRelative":"en/dev/api/message/rule.md","localizedDate":"August 21, 2024","autoDesc":true}`);export{i as comp,d as data};