Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaw committed Apr 20, 2024
1 parent 1fe77c7 commit 245b85a
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Client.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Friend.html

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions client_client.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contact_contact.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
switch (contact.chatType) {
case Friend.getChatType():
return new Friend(uin, uid);
return Friend.make(uin, uid);
case Group.getChatType():
return new Group(uin);
}
Expand Down
19 changes: 16 additions & 3 deletions contact_friend.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/search.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions event_event_channel.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
if (!msg) {
return;
}
const contact = msg.chatType == 1 ? new Friend(msg.peerUin, msg.peerUid) : (msg.chatType == 2 ? new Group(msg.peerUin) : null);
const contact = msg.chatType == 1 ? Friend.make(msg.peerUin, msg.peerUid) : (msg.chatType == 2 ? new Group(msg.peerUin) : null);
const source = new MessageSource(msg.msgId, contact);
const messageChain = new MessageChain(source);
messageChain.appendNatives(msg.elements);
Expand All @@ -36,7 +36,7 @@
if (!msgRecord) {
return;
}
const contact = msgRecord.chatType == 1 ? new Friend(msgRecord.peerUin, msgRecord.peerUid) : (msgRecord.chatType == 2 ? new Group(msgRecord.peerUin) : null);
const contact = msgRecord.chatType == 1 ? Friend.make(msgRecord.peerUin, msgRecord.peerUid) : (msgRecord.chatType == 2 ? new Group(msgRecord.peerUin) : null);
const source = new MessageSource(msgRecord.msgId, contact);
const messageChain = new MessageChain(source);
messageChain.appendNatives(msgRecord.elements);
Expand Down
7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
</code></pre><p>具体有哪些可用的 API 可以在下文查看。</p><h3 id="%E7%A4%BA%E4%BE%8B-1">示例</h3><pre class="prettyprint source lang-js"><code>import { Group, AtAll, PlainText, MessageChain } from '../LiteLoaderQQNT-Euphony/src/index.js';
const group = new Group(10000);
group.sendMessage(new MessageChain().append(new AtAll('Content')).append(new PlainText('Hello World!')));
</code></pre><p>这段代码会向 <strong>群号</strong><strong>10000</strong> 的群发送一条消息,其中包含一个显示为 <strong>Content</strong> 的@全体成员,以及一个内容为 <strong>Hello World!</strong> 的纯文本。</p><h2 id="%E8%AF%B4%E6%98%8E">说明</h2><p>无论使用以上哪种方法,都必须添加 <strong>Euphony</strong> 本身至 <strong>LiteLoaderQQNT</strong> 中作为插件加载。</p><h1 id="%E4%B8%89.-api%E4%BB%8B%E7%BB%8D">三. API介绍</h1><p>你可以在这里查看所有API介绍:<a href="https://xtaw.github.io/LiteLoaderQQNT-Euphony/">API文档</a></p><p>请注意,由于 <strong>Euphony</strong> 目前正处于开发初期,各 API 尚未完全实现,也并不稳定,很可能在将来发生很大变化。</p><h2 id="1.-native">1. Native</h2><p><strong>Euphony</strong><code>preload.js</code> 中导出了 <code>euphonyNative</code> 对象用于一些与 qq 底层交互的操作。 你可以在 <a href="https://xtaw.github.io/LiteLoaderQQNT-Euphony/">API文档</a> 中的 <strong>Global</strong> 部分查看详情介绍。</p><h2 id="2.-%E5%9F%BA%E7%A1%80%E4%BA%8B%E4%BB%B6">2. 基础事件</h2><h3 id="(1).-receive-message">(1). receive-message</h3><p>该事件触发于当qq接收到新消息时。 事件会传入一个 <code>MessageChain</code> 作为参数,表示接收到的新消息。</p><h3 id="(2).-send-message">(2). send-message</h3><p>该事件触发于当qq发送出新消息时。 事件会传入一个 <code>MessageChain</code> 作为参数,表示发送出的新消息。 请注意,该事件在本地消息显示发出后便会触发,而不是服务器收到发送请求后触发,可能存在消息发送失败依然触发该事件的情况,或消息还未发送出去便提前触发了该事件。因此,你无法直接在该事件触发后就去调用 <code>MessageChain.getSource().recall()</code> 等函数,因为此时消息还未被真正发送出去。</p></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">Euphony</a><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="At.html">At</a></div><div class="sidebar-section-children"><a href="AtAll.html">AtAll</a></div><div class="sidebar-section-children"><a href="Audio.html">Audio</a></div><div class="sidebar-section-children"><a href="Cache.html">Cache</a></div><div class="sidebar-section-children"><a href="Client.html">Client</a></div><div class="sidebar-section-children"><a href="Contact.html">Contact</a></div><div class="sidebar-section-children"><a href="EventChannel.html">EventChannel</a></div><div class="sidebar-section-children"><a href="Friend.html">Friend</a></div><div class="sidebar-section-children"><a href="Group.html">Group</a></div><div class="sidebar-section-children"><a href="Image.html">Image</a></div><div class="sidebar-section-children"><a href="MessageChain.html">MessageChain</a></div><div class="sidebar-section-children"><a href="MessageSource.html">MessageSource</a></div><div class="sidebar-section-children"><a href="PlainText.html">PlainText</a></div><div class="sidebar-section-children"><a href="Raw.html">Raw</a></div><div class="sidebar-section-children"><a href="SingleMessage.html">SingleMessage</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#convertUidToUin">convertUidToUin</a></div><div class="sidebar-section-children"><a href="global.html#convertUinToUid">convertUinToUid</a></div><div class="sidebar-section-children"><a href="global.html#invokeNative">invokeNative</a></div><div class="sidebar-section-children"><a href="global.html#subscribeEvent">subscribeEvent</a></div><div class="sidebar-section-children"><a href="global.html#unsubscribeEvent">unsubscribeEvent</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
</code></pre><p>这段代码会向 <strong>群号</strong><strong>10000</strong> 的群发送一条消息,其中包含一个显示为 <strong>Content</strong> 的@全体成员,以及一个内容为 <strong>Hello World!</strong> 的纯文本。</p><h2 id="%E8%AF%B4%E6%98%8E">说明</h2><p>无论使用以上哪种方法,都必须添加 <strong>Euphony</strong> 本身至 <strong>LiteLoaderQQNT</strong> 中作为插件加载。</p><h1 id="%E4%B8%89.-api%E4%BB%8B%E7%BB%8D">三. API介绍</h1><p>你可以在这里查看所有API介绍:<a href="https://xtaw.github.io/LiteLoaderQQNT-Euphony/">API文档</a></p><p>请注意,由于 <strong>Euphony</strong> 目前正处于开发初期,各 API 尚未完全实现,也并不稳定,很可能在将来发生很大变化。</p><h2 id="1.-native">1. Native</h2><p><strong>Euphony</strong><code>preload.js</code> 中导出了 <code>euphonyNative</code> 对象用于一些与 qq 底层交互的操作。 你可以在 <a href="https://xtaw.github.io/LiteLoaderQQNT-Euphony/">API文档</a> 中的 <strong>Global</strong> 部分查看详情介绍。</p><h2 id="2.-%E5%9F%BA%E7%A1%80%E4%BA%8B%E4%BB%B6">2. 基础事件</h2><h3 id="%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B">使用示例</h3><pre class="prettyprint source lang-js"><code>import { EventChannel } from '../LiteLoaderQQNT-Euphony/src/index.js';
const eventChannel = EventChannel.fromNative();
eventChannel.subscribeEvent('receive-message', message => {
console.log(message);
});
</code></pre><p>上面这段代码会监听 <strong>receive-message</strong> 事件,并输出事件参数。</p><h3 id="(1).-receive-message">(1). receive-message</h3><p>该事件触发于当qq接收到新消息时。 事件会传入一个 <code>MessageChain</code> 作为参数,表示接收到的新消息。</p><h3 id="(2).-send-message">(2). send-message</h3><p>该事件触发于当qq发送出新消息时。 事件会传入一个 <code>MessageChain</code> 作为参数,表示发送出的新消息。 请注意,该事件在本地消息显示发出后便会触发,而不是服务器收到发送请求后触发,可能存在消息发送失败依然触发该事件的情况,或消息还未发送出去便提前触发了该事件。因此,你无法直接在该事件触发后就去调用 <code>MessageChain.getSource().recall()</code> 等函数,因为此时消息还未被真正发送出去。</p></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">Euphony</a><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="At.html">At</a></div><div class="sidebar-section-children"><a href="AtAll.html">AtAll</a></div><div class="sidebar-section-children"><a href="Audio.html">Audio</a></div><div class="sidebar-section-children"><a href="Cache.html">Cache</a></div><div class="sidebar-section-children"><a href="Client.html">Client</a></div><div class="sidebar-section-children"><a href="Contact.html">Contact</a></div><div class="sidebar-section-children"><a href="EventChannel.html">EventChannel</a></div><div class="sidebar-section-children"><a href="Friend.html">Friend</a></div><div class="sidebar-section-children"><a href="Group.html">Group</a></div><div class="sidebar-section-children"><a href="Image.html">Image</a></div><div class="sidebar-section-children"><a href="MessageChain.html">MessageChain</a></div><div class="sidebar-section-children"><a href="MessageSource.html">MessageSource</a></div><div class="sidebar-section-children"><a href="PlainText.html">PlainText</a></div><div class="sidebar-section-children"><a href="Raw.html">Raw</a></div><div class="sidebar-section-children"><a href="SingleMessage.html">SingleMessage</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#convertUidToUin">convertUidToUin</a></div><div class="sidebar-section-children"><a href="global.html#convertUinToUid">convertUinToUid</a></div><div class="sidebar-section-children"><a href="global.html#invokeNative">invokeNative</a></div><div class="sidebar-section-children"><a href="global.html#subscribeEvent">subscribeEvent</a></div><div class="sidebar-section-children"><a href="global.html#unsubscribeEvent">unsubscribeEvent</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>

0 comments on commit 245b85a

Please sign in to comment.