ntqq
Version:
QQ protocol for NodeJS!
82 lines (60 loc) • 3.85 kB
Markdown
# ntqq
[](https://www.npmjs.com/package/ntqq)
[](https://www.npmjs.com/package/ntqq)
[](https://nodejs.org)
[](https://jq.qq.com/?_wv=1027&k=xAdGDRVh)
[](https://discord.gg/D7T7wPtwvb)
* QQ(安卓)协议基于 Node.js 的实现,支持最低node版本为 v14
* 若你不熟悉 Node.js 或不会组织代码,可通过 [template](https://github.com/ntqqjs/ntqq-template) 创建一个简单的应用程序
* [Type Docs](https://ntqqjs.github.io/ntqq/docs/)(文档仅供参考,具体类型以包内d.ts声明文件为准)
* [从 OICQ v1.x 升级](https://github.com/takayama-lily/oicq/projects/3#column-16638290)(v1 在 OICQ 的 master 分支)
* 如果你仍在使用 OICQ v1.x,又不想升级,可以使用 [oicq-icalingua-plus-plus](https://github.com/icalingua-plus-plus/oicq-icalingua-plus-plus)
ntqq 是 [OICQ](https://github.com/takayama-lily/oicq) 的分支。ntqq 的存在少不了 OICQ 作者 [takayama-lily](https://github.com/takayama-lily) 与 OICQ 的其它贡献者们,在此特别鸣谢!
---
## 与oicq2的差异
- `createClient`将不再传递uin,改为在`login`时传入,如果你希望密码登录,请**一定**参考[密码登录教程](https://github.com/ntqqjs/ntqq/wiki/%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95%E6%B5%81%E7%A8%8B)
- 支持频道(基础的消息收发能力)
- 支持群精华消息的添加和移除
- 消息类型添加ForwardElem
- 支持监听指定群/好友的消息
**安装:**
```bash
> npm i ntqq # or > yarn add ntqq
```
**快速上手:**
```js
const { createClient } = require("ntqq")
const client = createClient({platform:3})
client.on("system.online", () => console.log("Logged in!"));
client.on("message", e => {
console.log(e);
e.reply("hello world", true); //true表示引用对方的消息
});
client
.on("system.login.qrcode", function (e) {
//扫码后按回车登录
process.stdin.once("data", () => {
this.login();
});
})
.login();
```
注意:
- 扫码登录仅能使用Watch协议登录下进行,如需扫码登陆,请在creatClient时按照上方示例代码传入platform,其他协议暂时无法登陆
- 建议使用密码登录,只需验证一次设备便长期有效
[密码登录教程](https://github.com/ntqqjs/ntqq/wiki/%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95%E6%B5%81%E7%A8%8B)
**声明:**
* 想开发机器人的新用户推荐使用[zhin](https://github.com/zhinjs/zhin)框架开发。
* CQHTTP 用户建议使用[onebots](https://github.com/lc-cn/onebots),该项目同时支持OneBot V11 和OneBot V12。
* 云崽用户想迁移到ntqq,可参考[Miao-Yunzai](https://github.com/yoimiya-kokomi/Miao-Yunzai),该分支使用ntqq来代替oicq
**鸣谢:**
* [oicq](https://github.com/takayama-lily/oicq) ntqq原来的仓库
* [oicq-guild](https://github.com/takayama-lily/oicq-guild) 将其频道的api移植到ntqq上
* [oicq-icalingua-plus-plus](https://github.com/icalingua-plus-plus/oicq-icalingua-plus-plus) 参考了该分支上登录协议相关的pr
- [oicq](https://github.com/takayama-lily/oicq) ntqq原来的仓库
- [oicq-guild](https://github.com/takayama-lily/oicq-guild) 将其频道的api移植到ntqq上
- [oicq-icalingua-plus-plus](https://github.com/icalingua-plus-plus/oicq-icalingua-plus-plus) 参考了该分支上登录协议相关的pr
**其他:**
- [QQWebApi](./web-api.md) QQ Web Api 收集整理 (途中)
- [TXHook](https://github.com/fuqiuluo/TXHook) 抓包工具推荐 **参与贡献:**
- [贡献指南](./CONTRIBUTING.md)