1
0
forked from bot/app
LiteyukiBot/assets/event.html-BW3xXJGK.js

39 lines
12 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as s,o as n,c as e,e as a}from"./app-BrSLFMno.js";const t={},p=a(`<h3 id="class-messageevent" tabindex="-1"><a class="header-anchor" href="#class-messageevent"><span><strong>class</strong> <code>MessageEvent</code></span></a></h3><h3 id="method-init-self-bot-id-str-message-list-dict-str-any-str-message-type-str-raw-message-str-session-id-str-user-id-str-session-type-str-receive-channel-optional-channel-messageevent-none-data-optional-dict-str-any-none" tabindex="-1"><a class="header-anchor" href="#method-init-self-bot-id-str-message-list-dict-str-any-str-message-type-str-raw-message-str-session-id-str-user-id-str-session-type-str-receive-channel-optional-channel-messageevent-none-data-optional-dict-str-any-none"><span><em>method</em> <code>__init__(self, bot_id: str, message: list[dict[str, Any]] | str, message_type: str, raw_message: str, session_id: str, user_id: str, session_type: str, receive_channel: Optional[Channel[MessageEvent]] = None, data: Optional[dict[str, Any]] = None)</code></span></a></h3><p><strong>Description</strong>: 轻雪抽象消息事件</p><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">__init__</span><span class="token punctuation">(</span>self<span class="token punctuation">,</span> bot_id<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> message<span class="token punctuation">:</span> <span class="token builtin">list</span><span class="token punctuation">[</span><span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">|</span> <span class="token builtin">str</span><span class="token punctuation">,</span> message_type<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> raw_message<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> session_id<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> user_id<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> session_type<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> receive_channel<span class="token punctuation">:</span> Optional<span class="token punctuation">[</span>Channel<span class="token punctuation">[</span><span class="token string">&#39;MessageEvent&#39;</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token operator">=</span><span class="token boolean">None</span><span class="token punctuation">,</span> data<span class="token punctuation">:</span> Optional<span class="token punctuation">[</span><span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token operator">=</span><span class="token boolean">None</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token triple-quoted-string string">&quot;&quot;&quot;
轻雪抽象消息事件
Args:
bot_id: 机器人ID
message: 消息,消息段数组[{type: str, data: dict[str, Any]}]
raw_message: 原始消息(通常为纯文本的格式)
message_type: 消息类型(private, group, other)
session_id: 会话ID(私聊通常为用户ID群聊通常为群ID)
session_type: 会话类型(private, group)
receive_channel: 接收频道(用于回复消息)
data: 附加数据
&quot;&quot;&quot;</span>
<span class="token keyword">if</span> data <span class="token keyword">is</span> <span class="token boolean">None</span><span class="token punctuation">:</span>
data <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
self<span class="token punctuation">.</span>message_type <span class="token operator">=</span> message_type
self<span class="token punctuation">.</span>data <span class="token operator">=</span> data
self<span class="token punctuation">.</span>bot_id <span class="token operator">=</span> bot_id
self<span class="token punctuation">.</span>message <span class="token operator">=</span> message
self<span class="token punctuation">.</span>raw_message <span class="token operator">=</span> raw_message
self<span class="token punctuation">.</span>session_id <span class="token operator">=</span> session_id
self<span class="token punctuation">.</span>session_type <span class="token operator">=</span> session_type
self<span class="token punctuation">.</span>user_id <span class="token operator">=</span> user_id
self<span class="token punctuation">.</span>receive_channel <span class="token operator">=</span> receive_channel
</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 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 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 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="method-reply-self-message-str-dict-str-any" tabindex="-1"><a class="header-anchor" href="#method-reply-self-message-str-dict-str-any"><span><em>method</em> <code>reply(self, message: str | dict[str, Any])</code></span></a></h3><p><strong>Description</strong>: 回复消息</p><p><strong>Arguments</strong>:</p><blockquote><ul><li>message:</li></ul></blockquote><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">reply</span><span class="token punctuation">(</span>self<span class="token punctuation">,</span> message<span class="token punctuation">:</span> <span class="token builtin">str</span> <span class="token operator">|</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token triple-quoted-string string">&quot;&quot;&quot;
回复消息
Args:
message:
Returns:
&quot;&quot;&quot;</span>
reply_event <span class="token operator">=</span> MessageEvent<span class="token punctuation">(</span>message_type<span class="token operator">=</span>self<span class="token punctuation">.</span>session_type<span class="token punctuation">,</span> message<span class="token operator">=</span>message<span class="token punctuation">,</span> raw_message<span class="token operator">=</span><span class="token string">&#39;&#39;</span><span class="token punctuation">,</span> data<span class="token operator">=</span><span class="token punctuation">{</span><span class="token string">&#39;message&#39;</span><span class="token punctuation">:</span> message<span class="token punctuation">}</span><span class="token punctuation">,</span> bot_id<span class="token operator">=</span>self<span class="token punctuation">.</span>bot_id<span class="token punctuation">,</span> session_id<span class="token operator">=</span>self<span class="token punctuation">.</span>session_id<span class="token punctuation">,</span> user_id<span class="token operator">=</span>self<span class="token punctuation">.</span>user_id<span class="token punctuation">,</span> session_type<span class="token operator">=</span>self<span class="token punctuation">.</span>session_type<span class="token punctuation">,</span> receive_channel<span class="token operator">=</span><span class="token boolean">None</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> self<span class="token punctuation">.</span>receive_channel<span class="token punctuation">:</span>
self<span class="token punctuation">.</span>receive_channel<span class="token punctuation">.</span>send<span class="token punctuation">(</span>reply_event<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 class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details>`,9),o=[p];function i(l,c){return n(),e("div",null,o)}const u=s(t,[["render",i],["__file","event.html.vue"]]),d=JSON.parse('{"path":"/en/dev/api/message/event.html","title":"liteyuki.message.event","lang":"en-US","frontmatter":{"title":"liteyuki.message.event","description":"class MessageEvent method __init__(self, bot_id: str, message: list[dict[str, Any]] | str, message_type: str, raw_message: str, session_id: str, user_id: str, session_type: str,...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/message/event.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/message/event.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.message.event"}],["meta",{"property":"og:description","content":"class MessageEvent method __init__(self, bot_id: str, message: list[dict[str, Any]] | str, message_type: str, raw_message: str, session_id: str, user_id: str, session_type: str,..."}],["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.event\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-29T06:19:39.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"class MessageEvent","slug":"class-messageevent","link":"#class-messageevent","children":[]},{"level":3,"title":"method __init__(self, bot_id: str, message: list[dict[str, Any]] | str, message_type: str, raw_message: str, session_id: str, user_id: str, session_type: str, receive_channel: Optional[Channel[MessageEvent]] = None, data: Optional[dict[str, Any]] = None)","slug":"method-init-self-bot-id-str-message-list-dict-str-any-str-message-type-str-raw-message-str-session-id-str-user-id-str-session-type-str-receive-channel-optional-channel-messageevent-none-data-optional-dict-str-any-none","link":"#method-init-self-bot-id-str-message-list-dict-str-any-str-message-type-str-raw-message-str-session-id-str-user-id-str-session-type-str-receive-channel-optional-channel-messageevent-none-data-optional-dict-str-any-none","children":[]},{"level":3,"title":"method reply(self, message: str | dict[str, Any])","slug":"method-reply-self-message-str-dict-str-any","link":"#method-reply-self-message-str-dict-str-any","children":[]}],"git":{"createdTime":1724234361000,"updatedTime":1724912379000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":2}]},"readingTime":{"minutes":0.88,"words":264},"filePathRelative":"en/dev/api/message/event.md","localizedDate":"August 21, 2024","autoDesc":true}');export{u as comp,d as data};