Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
takayama-lily committed Nov 6, 2021
1 parent 7126e46 commit ad4a5f5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# oicq

[![npm version](https://img.shields.io/npm/v/oicq/beta.svg)](https://www.npmjs.com/package/oicq)
[![npm version](https://img.shields.io/npm/v/oicq/latest.svg)](https://www.npmjs.com/package/oicq)
[![dm](https://shields.io/npm/dm/oicq)](https://www.npmjs.com/package/oicq)
[![node engine](https://img.shields.io/node/v/oicq/beta.svg)](https://nodejs.org)
[![node engine](https://img.shields.io/node/v/oicq/latest.svg)](https://nodejs.org)
[![discord](https://img.shields.io/static/v1?label=chat&message=on%20discord&color=7289da&logo=discord)](https://discord.gg/gKnU7BARzv)

* QQ(安卓)协议基于Node.js的实现,支持最低node版本为 v14
* 若你不熟悉Node.js或不会组织代码,可通过 [template](https://github.com/takayama-lily/oicq-template) 创建一个简单的应用程序
* [API Reference](#api-reference) / [Type Docs](https://takayama-lily.github.io/oicq/)
* [从v1.x升级](https://github.com/takayama-lily/oicq/projects/3#column-16638290)
* [从v1.x升级](https://github.com/takayama-lily/oicq/projects/3#column-16638290) (v1在master分支)

----

**Install:**

> 此分支(v2.0)暂时处于beta状态
```bash
> npm i oicq@beta # or > yarn add oicq@beta
> npm i oicq # or > yarn add oicq
```

**Usage:**
Expand All @@ -28,12 +26,12 @@ const account = 147258369
const client = createClient(account)

client.on("system.online", () => console.log("Logged in!"))
client.on("message", msg => {
console.log(msg)
msg.reply("hello world")
client.on("message", e => {
console.log(e)
e.reply("hello world", true) //true表示引用对方的消息
})

client.on("system.login.qrcode", function (event) {
client.on("system.login.qrcode", function (e) {
//扫码后按回车登录
process.stdin.once("data", () => {
this.login()
Expand Down Expand Up @@ -146,7 +144,7 @@ client.on("system.login.qrcode", function (event) {

### Class: Group

> 所有的`notice.group``message.group`事件中含有此实例
> 所有的`notice.group``message.group`事件的上报数据中含有此实例 (`e.group`访问)
|Method|Description|
|-|-|
Expand Down Expand Up @@ -212,7 +210,7 @@ client.on("system.login.qrcode", function (event) {
### Class: Friend

> 继承 [User](#class-user) 的所有方法和属性
> 所有的`notice.friend``message.private`事件中含有此实例
> 所有的`notice.friend``message.private`事件中含有此实例 (`e.friend`访问)
|Method|Description|
|-|-|
Expand All @@ -235,7 +233,7 @@ client.on("system.login.qrcode", function (event) {
### Class: Member

> 继承 [User](#class-user) 的所有方法和属性
> 所有的`message.group`事件中含有此实例
> 所有的`message.group`事件中含有此实例 (`e.member`访问)
|Method|Description|
|-|-|
Expand Down
6 changes: 1 addition & 5 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export { Message, PrivateMessage, GroupMessage, DiscussMessage, ForwardMessage,
MusicPlatform, Sendable, Anonymous, MessageElem, FileElem, ReplyElem,
TextElem, AtElem, FaceElem, BfaceElem, MfaceElem, ImageElem, MiraiElem,
FlashElem, PttElem, VideoElem, XmlElem, JsonElem, ShareElem, LocationElem, PokeElem,
parseDmMessageId, parseGroupMessageId, parseImageFileParam, segment } from "./message"
parseDmMessageId, parseGroupMessageId, parseImageFileParam, getGroupImageUrl, segment } from "./message"
export { PrivateMessageEvent, GroupMessageEvent, DiscussMessageEvent, MessageRet,
MessageEvent, RequestEvent, FriendNoticeEvent, GroupNoticeEvent,
FriendRequestEvent, GroupRequestEvent, GroupInviteEvent, EventMap,
Expand All @@ -19,7 +19,3 @@ export { PrivateMessageEvent, GroupMessageEvent, DiscussMessageEvent, MessageRet
GroupAdminEvent, GroupMuteEvent, GroupTransferEvent } from "./events"
export { ApiRejection, Device, Apk, Platform, Domain } from "./core"
export * as core from "./core"

export function getGroupImageUrl(md5: string) {
return `https://gchat.qpic.cn/gchatpic_new/0/0-0-${md5.toUpperCase()}/0`
}
1 change: 1 addition & 0 deletions lib/message/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from "./message"
export * from "./elements"
export * from "./image"
export * from "./converter"
export * from "./parser"
export * from "./music"
6 changes: 5 additions & 1 deletion lib/message/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,15 @@ export class Parser {
elem = {
type,
file: buildImageFileParam(proto[13].toHex(), proto[25], proto[22], proto[23], proto[20]),
url: proto[16] ? `https://gchat.qpic.cn${proto[16]}` : `https://gchat.qpic.cn/gchatpic_new/0/0-0-${proto[13].toHex().toUpperCase()}/0`,
url: proto[16] ? `https://gchat.qpic.cn${proto[16]}` : getGroupImageUrl(proto[13].toHex()),
}
if (elem.type === "image")
elem.asface = proto[34]?.[1] === 1
}
return elem
}
}

export function getGroupImageUrl(md5: string) {
return `https://gchat.qpic.cn/gchatpic_new/0/0-0-${md5.toUpperCase()}/0`
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oicq",
"version": "2.1.2-beta",
"upday": "2021/11/01",
"version": "2.1.3",
"upday": "2021/11/07",
"description": "QQ protocol!",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down

0 comments on commit ad4a5f5

Please sign in to comment.