# node-onebot
> 将机器人部署为独立的服务,通过http或ws与外界通信
* 基于 [npm-oicq](https://github.com/takayama-lily/oicq) 的QQ机器人Http-Api
* [onebot(cqhttp)](https://cqhttp.cc) 协议的实现
* 当前master分支下的版本基本不会再有变化,及时更新依赖即可获得新特性和已知bug的修复。
* [如何获得滑动验证码的ticket](https://github.com/takayama-lily/onebot/issues/28)
* [环境异常等问题](https://github.com/takayama-lily/onebot/issues/12)
[![core](https://img.shields.io/badge/core-oicq-brightgreen)](https://www.npmjs.com/package/oicq)
[![node engine](https://img.shields.io/node/v/oicq.svg)](https://nodejs.org)
**使用方法:**
1. 下载安装 [nodejs](https://nodejs.org)
2. 下载此源码包 (建议用`git clone`)
<s>执行 `npm up --no-save` 安装依赖 (已集成自动安装)</s>
3. 重命名 `config.sample.js` 为 `config.js` 并配置
4. 运行 `node main 123456789` (数字是登陆账号)
* 今后启动只需最后一步
* 只有首次登陆时需要交互(密码、验证码、设备锁),之后推荐使用pm2或forever等部署工具。
----
## 通信
* [x] HTTP和正向WS服务器
* [x] POST上报(多点)
* [x] 反向WS连接(多点)
----
## API ([参考文档](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md))
<details>
<summary>已实现(文档中已列出)</summary>
|名称|备注|
|-|-|
|get_friend_list |
|get_group_list |
|get_group_info |
|get_group_member_list |
|get_group_member_info |
|get_stranger_info |
|**send_private_msg** |message_id是string
|**send_group_msg** |message_id是string
|send_msg |
|delete_msg |
|get_msg |
|set_friend_add_request |
|set_group_add_request |
|set_group_special_title|
|set_group_admin |
|set_group_card |
|set_group_kick |
|set_group_ban |
|set_group_leave |
|set_group_name |
|set_group_whole_ban |
|set_group_anonymous_ban|仅支持flag字段,不支持另外两种
|set_group_anonymous |
|send_like |
|get_login_info |
|can_send_image |
|can_send_record |
|get_status |
|get_version_info |
|.handle_quick_operation|仅WS有效
|get_cookies |
|get_csrf_token |
|clean_cache |
</details>
<details>
<summary>已实现(新增)</summary>
|名称|参数|备注|
|-|-|-|
|get_stranger_list ||获取陌生人列表
|send_discuss_msg |discuss_id<br>message<br>auto_escape|发讨论组消息,没有message_id
|send_group_notice |content|发送群公告
|send_group_poke |group_id<br>user_id|群戳一戳,未来可能会用CQ码实现
|set_online_status |status|设置在线状态(※仅限手机协议支持)<br>11我在线上 31离开 41隐身 50忙碌 60Q我吧 70请勿打扰|
|add_group |group_id<br>comment|加群和加好友是风险接口,频繁调用账号会被风控
|add_friend |group_id<br>user_id<br>comment|添加好友<br>暂时只能添加群员
|delete_friend |user_id<br>block|删除好友<br>block默认为true
|invite_friend |group_id<br>user_id|邀请好友入群
|set_nickname |nickname|设置昵称
|set_gender |gender|设置性别 0未知 1男 2女
|set_birthday |birthday|设置生日 格式:20110202
|set_description |description|设置个人说明
|set_signature |signature|设置签名
|set_portrait |file|设置个人头像,与CQ码中的file格式相同
|set_group_portrait |file|设置群头像
</details>
<details>
<summary>尚未实现</summary>
|名称|
|-|
|get_forward_msg|
|get_group_honor_info|
|get_credentials|
|get_vip_info|
|get_record|
|get_image|
|set_restart|
</details>
----
## Events
<details>
<summary>点开</summary>
新版事件的notice部分的上报格式默认与cqhttp中的格式不同。
如需使用cqhttp格式,在config.js中将`use_cqhttp_notice`设置为`true`。
||新版格式([文档](https://github.com/takayama-lily/oicq/blob/master/docs/event.md))|cqhttp格式([文档](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/README.md))|
|-|-|-|
|好友请求|request.friend.add |request.friend |
|加群请求|request.group.add |request.group.add |
|加群邀请|request.group.invite |request.group.invite |
|好友消息|message.private.friend |message.private.friend |
|单向好友|message.private.single | |
|临时会话|message.private.group |message.private.group |
|临时会话|message.private.other |message.private.other |
|群聊消息|message.group.normal |message.group.normal |
|匿名消息|message.group.anonymous|message.group.anonymous|
|讨论组消|message.discuss | |
|好友增加|notice.friend.increase |notice.friend_add |
|好友减少|notice.friend.decrease | |
|好友撤回|notice.friend.recall |notice.friend_recall |
|资料变更|notice.friend.profile | |
|群员增加|notice.group.increase |notice.group_increase |
|群员减少|notice.group.decrease |notice.group_decrease |
|群组撤回|notice.group.recall |notice.group_recall |
|管理变更|notice.group.admin |notice.group_admin |
|群组禁言|notice.group.ban |notice.group_ban |
|群组转让|notice.group.transfer | |
|群组文件|表现为CQ码 |notice.group_upload |
|头衔变更|notice.group.title | |
|群戳一戳|notice.group.poke | |
|群设置变|notice.group.setting | |
|元事件|meta_event.lifecycle.enable|meta_event.lifecycle.enable|
|元事件|meta_event.lifecycle.disable|meta_event.lifecycle.disable|
|元事件|meta_event.lifecycle.connect|meta_event.lifecycle.connect|
|元事件|meta_event.heartbeat|meta_event.heartbeat|
</details>
----
## 其他
* [x] 字符串或数组消息段
* [x] 鉴权
* [x] WS心跳
* [x] _async异步调用api
* [x] _rate_limited限速调用api
* [x] [事件过滤器](https://richardchien.gitee.io/coolq-http-api/docs/4.15/#/EventFilter)
* [x] 设置风控重发
* [x] 设置允许跨域请求
* [x] 设置监听自己消息
* [x] 自动更新内核版本
[内核功能支持和CQ码](https://github.com/takayama-lily/oicq/blob/dev/docs/project.md)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
节点一机器人 将机器人部署为独立的服务,通过http或ws与外部通信 基于的QQ机器人Http-Api 协议的实现 当前主分支的下一个版本基本不会再有变化,及时更新依赖即可获得新特性和已知的bug的修复。 使用方法: 下载安装 下载此原始包(建议用git clone )执行npm up --no-save安装依赖(已集成自动安装) 重命名config.sample.js为config.js并配置 运行node main 123456789 (数字是登陆账号) 即将启动只需最后一步 只有首次登陆时需要交互(密码,验证码,设备锁),之后推荐使用pm2或forever等部署工具。 通信 HTTP
资源推荐
资源详情
资源评论
收起资源包目录
node-onebot-master.zip (12个子文件)
node-onebot-master
.gitignore 36B
Dockerfile 264B
package.json 531B
main.js 1KB
LICENSE 1KB
config.sample.js 2KB
docker-compose.yaml 245B
README.md 6KB
lib
filter.js 3KB
cq-notice.js 1KB
api.js 6KB
core.js 12KB
共 12 条
- 1
资源评论
流浪的夏先森
- 粉丝: 22
- 资源: 4688
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Image_1713714819368.png
- 数据可视化 matplotlib 实例.docx
- Python 使用 Matplotlib 绘制甘特图的实践.docx
- matplotlib 中的 cmap 参数介绍.docx
- 基于matlab的毕业设计基于Matlab使用LQR实现车辆轨迹跟踪源码.zip
- 基于Matplotlib 的高互动性可视化系统设计与实现
- matplotlib 数据可视化报告.docx
- 传统网页UI设计在移动应用开发中的应用研究.pdf
- 基于pytorch实现BERT+BiLSTM+CRF实现中文命名实体识别源码.zip
- 校园帮项目,毕业设计/课程设计/javaWeb/SSM
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功