import{_ as e,o as n,c as s,e as a}from"./app-BvUYPzLF.js";const t={},o=a(`
说明: 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
源代码 或 在GitHub上查看
def __init__(self, handler: RuleHandlerFunc):
self.handler = handler
源代码 或 在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)
源代码 或 在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)
源代码 或 在GitHub上查看
async def __call__(self, event: MessageEvent) -> bool:
if self.handler is None:
return True
return await self.handler(event)
@Rule
源代码 或 在GitHub上查看
@Rule
async def empty_rule(event: MessageEvent) -> bool:
return True
@Rule
源代码 或 在GitHub上查看
@Rule
async def is_su_rule(event: MessageEvent) -> bool:
return str(event.user_id) in _superusers
`,20),l=[o];function p(i,r){return n(),s("div",null,l)}const u=e(t,[["render",p],["__file","rule.html.vue"]]),d=JSON.parse('{"path":"/dev/api/message/rule.html","title":"liteyuki.message.rule","lang":"zh-CN","frontmatter":{"title":"liteyuki.message.rule","lastUpdated":false,"description":"liteyuki.message.rule 说明: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/8/19 下午10:55 @Author : snowykami @Email : snowykami@outlook.com @File : rule.p...","head":[["link",{"rel":"alternate","hreflang":"en-us","href":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/message/rule.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/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 说明: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/8/19 下午10:55 @Author : snowykami @Email : snowykami@outlook.com @File : rule.p..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:locale:alternate","content":"en-US"}],["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.09,"words":326},"filePathRelative":"dev/api/message/rule.md","localizedDate":"2024年8月21日","autoDesc":true}');export{u as comp,d as data};