mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-15 13:14:24 +08:00
19 lines
9.7 KiB
JavaScript
19 lines
9.7 KiB
JavaScript
|
import{_ as n,o as s,c as a,d as e}from"./app-EhCe7g9m.js";const t={},o=e(`<h3 id="func-add-matcher" tabindex="-1"><a class="header-anchor" href="#func-add-matcher"><span><em>func</em> <code>add_matcher()</code></span></a></h3><details><summary><b>Source code</b></summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">add_matcher</span><span class="token punctuation">(</span>matcher<span class="token punctuation">:</span> Matcher<span class="token punctuation">)</span><span class="token punctuation">:</span>
|
||
|
<span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token punctuation">,</span> m<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token builtin">enumerate</span><span class="token punctuation">(</span>_matcher_list<span class="token punctuation">)</span><span class="token punctuation">:</span>
|
||
|
<span class="token keyword">if</span> m<span class="token punctuation">.</span>priority <span class="token operator"><</span> matcher<span class="token punctuation">.</span>priority<span class="token punctuation">:</span>
|
||
|
_matcher_list<span class="token punctuation">.</span>insert<span class="token punctuation">(</span>i<span class="token punctuation">,</span> matcher<span class="token punctuation">)</span>
|
||
|
<span class="token keyword">break</span>
|
||
|
<span class="token keyword">else</span><span class="token punctuation">:</span>
|
||
|
_matcher_list<span class="token punctuation">.</span>append<span class="token punctuation">(</span>matcher<span class="token punctuation">)</span>
|
||
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="func-on-message-rule-rule-empty-rule-priority-int-0-block-bool-false-matcher" tabindex="-1"><a class="header-anchor" href="#func-on-message-rule-rule-empty-rule-priority-int-0-block-bool-false-matcher"><span><em>func</em> <code>on_message(rule: Rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher</code></span></a></h3><details><summary><b>Source code</b></summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">on_message</span><span class="token punctuation">(</span>rule<span class="token punctuation">:</span> Rule<span class="token operator">=</span>empty_rule<span class="token punctuation">,</span> priority<span class="token punctuation">:</span> <span class="token builtin">int</span><span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span> block<span class="token punctuation">:</span> <span class="token builtin">bool</span><span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">></span> Matcher<span class="token punctuation">:</span>
|
||
|
matcher <span class="token operator">=</span> Matcher<span class="token punctuation">(</span>rule<span class="token punctuation">,</span> priority<span class="token punctuation">,</span> block<span class="token punctuation">)</span>
|
||
|
add_matcher<span class="token punctuation">(</span>matcher<span class="token punctuation">)</span>
|
||
|
<span class="token keyword">return</span> matcher
|
||
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="func-on-keywords-keywords-list-str-empty-rule-rule-0-priority-int-false-matcher" tabindex="-1"><a class="header-anchor" href="#func-on-keywords-keywords-list-str-empty-rule-rule-0-priority-int-false-matcher"><span><em>func</em> <code>on_keywords(keywords: list[str] = empty_rule, rule = 0, priority: int = False) -> Matcher</code></span></a></h3><details><summary><b>Source code</b></summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">on_keywords</span><span class="token punctuation">(</span>keywords<span class="token punctuation">:</span> <span class="token builtin">list</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">]</span><span class="token punctuation">,</span> rule<span class="token operator">=</span>empty_rule<span class="token punctuation">,</span> priority<span class="token punctuation">:</span> <span class="token builtin">int</span><span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span> block<span class="token punctuation">:</span> <span class="token builtin">bool</span><span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">></span> Matcher<span class="token punctuation">:</span>
|
||
|
|
||
|
<span class="token decorator annotation punctuation">@Rule</span>
|
||
|
<span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">on_keywords_rule</span><span class="token punctuation">(</span>event<span class="token punctuation">:</span> MessageEvent<span class="token punctuation">)</span><span class="token punctuation">:</span>
|
||
|
<span class="token keyword">return</span> <span class="token builtin">any</span><span class="token punctuation">(</span><span class="token punctuation">(</span>keyword <span class="token keyword">in</span> event<span class="token punctuation">.</span>raw_message <span class="token keyword">for</span> keyword <span class="token keyword">in</span> keywords<span class="token punctuation">)</span><span class="token punctuation">)</span>
|
||
|
<span class="token keyword">return</span> on_message<span class="token punctuation">(</span>on_keywords_rule <span class="token operator">&</span> rule<span class="token punctuation">,</span> priority<span class="token punctuation">,</span> block<span class="token punctuation">)</span>
|
||
|
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="var-matcher-list" tabindex="-1"><a class="header-anchor" href="#var-matcher-list"><span><em><strong>var</strong></em> <code>_matcher_list = []</code></span></a></h3><ul><li><strong>Type</strong>: <code>list[Matcher]</code></li></ul><h3 id="var-queue-queue" tabindex="-1"><a class="header-anchor" href="#var-queue-queue"><span><em><strong>var</strong></em> <code>_queue = Queue()</code></span></a></h3><ul><li><strong>Type</strong>: <code>Queue</code></li></ul>`,10),p=[o];function l(c,r){return s(),a("div",null,p)}const u=n(t,[["render",l],["__file","on.html.vue"]]),d=JSON.parse('{"path":"/en/api/message/on.html","title":"liteyuki.message.on","lang":"en-US","frontmatter":{"title":"liteyuki.message.on","description":"func add_matcher() Source code func on_message(rule: Rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher Source code func on_keywords(keywords: list[str] = emp...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/api/message/on.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/api/message/on.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.message.on"}],["meta",{"property":"og:description","content":"func add_matcher() Source code func on_message(rule: Rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher Source code func on_keywords(keywords: list[str] = emp..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.message.on\\",\\"image\\":[\\"\\"],\\"dateModified\\":null,\\"author\\":[]}"]]},"headers":[{"level":3,"title":"func add_matcher()","slug":"func-add-matcher","link":"#func-add-matcher","children":[]},{"level":3,"title":"func on_message(rule: Rule = empty_rule, priority: int = 0, block: bool = False) -> Matcher","slug":"func-on-message-rule-rule-empty-rule-priority-int-0-block-bool-false-matcher","link":"#func-on-message-rule-rule-empty-rule-priority-int-0-block-bool-false-matcher","children":[]},{"level":3,"title":"func on_keywords(keywords: list[str] = empty_rule, rule = 0, priority: int = False) -> Matcher","slug":"func-on-keywords-keywords-list-str-empty-rule-rule-0-priority-int-false-matcher","link":"#func-on-keywords-keywords-list-str-empty-rule-rule-0-priority-int-false-matcher","children":[]},{"level":3,"title":"var _matcher_list = []","slug":"var-matcher-list","link":"#var-matcher-list","children":[]},{"level":3,"title":"var _queue = Queue()","slug":"var-queue-queue","link":"#var-queue-queue","children":[]}],"git":{"createdTime":null,"updatedTime":null,"contributors":[]},"readingTime":{"minutes":0.47,"words":141},"filePathRelative":"en/api/message/on.md","autoDesc":true}');export{u as comp,d as data};
|