Lagrange.Core/README.md

305 lines
20 KiB
Markdown
Raw Permalink Normal View History

2023-06-28 05:28:39 +02:00
<div align="center">
# Lagrange.Core
[![Core](https://img.shields.io/badge/Lagrange-Core-blue)](#)
2023-10-17 11:09:14 +02:00
[![OneBot](https://img.shields.io/badge/Lagrange-OneBot-blue)](#)
[![C#](https://img.shields.io/badge/Core-%20.NET_6-blue)](#)
[![C#](https://img.shields.io/badge/OneBot-%20.NET_7-blue)](#)
[![License](https://img.shields.io/static/v1?label=LICENSE&message=GPL-3.0&color=lightrey)](#)
2023-10-10 06:16:00 +02:00
[![QQ](https://img.shields.io/static/v1?label=QQGroup&message=348981074&color=red)](#)
2023-06-28 05:28:39 +02:00
An Implementation of NTQQ Protocol, with Pure C#, Derived from Konata.Core
</div>
2023-10-17 06:16:17 +02:00
## Disclaimer
The Lagrange.Core project, including its developers, contributors, and affiliated individuals or entities, hereby explicitly disclaim any association with, support for, or endorsement of any form of illegal behavior. This disclaimer extends to any use or application of the Lagrange.Core project that may be contrary to local, national, or international laws, regulations, or ethical guidelines.
Lagrange.Core is an open-source software project designed to facilitate lawful and ethical applications in its intended use cases. It is the responsibility of each user to ensure that their usage of Lagrange.Core complies with all applicable laws and regulations in their jurisdiction.
The developers and contributors of Lagrange.Core assume no liability whatsoever for any actions taken by users that violate the law or engage in any form of illicit activity. Users are solely responsible for their own actions and any consequences that may arise from the use of Lagrange.Core.
Furthermore, any discussions, suggestions, or guidance provided by the Lagrange.Core community, including its developers, contributors, and users, should not be interpreted as legal advice. It is strongly recommended that users seek independent legal counsel to understand the legal implications of their actions and ensure compliance with the relevant laws and regulations.
By using or accessing Lagrange.Core, the user acknowledges and agrees to release the developers, contributors, and affiliated individuals or entities from any and all liability arising from the use or misuse of the project, including any legal consequences incurred as a result of their actions.
Please use Lagrange.Core responsibly and in accordance with the law.
2023-06-28 05:28:39 +02:00
## Features List
2023-10-17 06:16:17 +02:00
| Protocol | Support | Login | Support | Messages | Support | Operations | Support | Events | Support |
| -------- | :-----: | ------------------------- | :-----: | :-------------- | :-----: | :---------------- | :-----: | :------------------ | :-----: |
| Windows | 🟢 | QrCode | 🟢 | Images | 🟢 | ~~Poke~~ | 🔴 | Captcha | 🟢 |
| macOS | 🟢 | Password | 🟢 | Text / At | 🟢 | Recall | 🟡 | BotOnline | 🟢 |
| Linux | 🟢 | EasyLogin | 🟢 | ~~Records~~ | 🔴 | Leave Group | 🟢 | BotOffline | 🟢 |
| | | UnusalDevice<br/>Password | 🔴 | QFace | 🟢 | ~~Special Title~~ | 🔴 | Message | 🟢 |
| | | UnusalDevice<br/>Easy | 🟢 | Json | 🟡 | Kick Member | 🟢 | ~~Poke~~ | 🔴 |
| | | NewDeviceVerify | 🔴 | Xml | 🟢 | Mute Member | 🟢 | MessageRecall | 🔴 |
| | | | | Forward | 🟢 | Set Admin | 🟢 | GroupMemberDecrease | 🟢 |
| | | | | Video | 🔴 | Friend Request | 🔴 | GroupMemberIncrease | 🟢 |
| | | | | ~~Flash Image~~ | 🔴 | Group Request | 🔴 | GroupPromoteAdmin | 🟢 |
| | | | | Reply | 🟢 | ~~Voice Call~~ | 🔴 | GroupInvite | 🟢 |
| | | | | File | 🟡 | Client Key | 🟢 | GroupRequestJoin | 🔴 |
| | | | | | | Cookies | 🟢 | FriendRequest | 🔴 |
| | | | | | | Send Message | 🟢 | ~~FriendTyping~~ | 🔴 |
| | | | | | | | | ~~FriendVoiceCall~~ | 🔴 |
2023-06-28 05:28:39 +02:00
2023-10-16 15:24:36 +02:00
## Lagrange.OneBot
2023-10-16 15:24:36 +02:00
### Implementation - OneBot v11
<Details>
<Summary>Message Segement</Summary>
2023-10-17 06:16:17 +02:00
| Message Segement | Support |
| ---------------- | :-----: |
| [Text] | 🟢 |
| [Face] | 🟢 |
| [Image] | 🟢 |
| [Record] | 🔴 |
| [Video] | 🔴 |
| [At] | 🟢 |
| [Rps] | 🔴 |
| [Dice] | 🔴 |
| [Shake] | 🔴 |
| [Poke] | 🔴 |
| [Anonymous] | 🔴 |
| [Share] | 🔴 |
| [Contact] | 🔴 |
| [Location] | 🔴 |
| [Music] | 🔴 |
| [Reply] | 🔴 |
| [Forward] | 🔴 |
| [Node] | 🔴 |
| [Xml] | 🔴 |
| [Json] | 🔴 |
[Text]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#qq-%E8%A1%A8%E6%83%85
[Record]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E8%AF%AD%E9%9F%B3
[Face]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#qq-%E8%A1%A8%E6%83%85
[Image]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E5%9B%BE%E7%89%87
[Shake]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E7%AA%97%E5%8F%A3%E6%8A%96%E5%8A%A8%E6%88%B3%E4%B8%80%E6%88%B3-
[Poke]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E6%88%B3%E4%B8%80%E6%88%B3
[Anonymous]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E5%8C%BF%E5%90%8D%E5%8F%91%E6%B6%88%E6%81%AF-
[Location]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E4%BD%8D%E7%BD%AE
[Video]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E7%9F%AD%E8%A7%86%E9%A2%91
[At]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E6%9F%90%E4%BA%BA
[Rps]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E7%8C%9C%E6%8B%B3%E9%AD%94%E6%B3%95%E8%A1%A8%E6%83%85
[Dice]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E6%8E%B7%E9%AA%B0%E5%AD%90%E9%AD%94%E6%B3%95%E8%A1%A8%E6%83%85
[share]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E9%93%BE%E6%8E%A5%E5%88%86%E4%BA%AB
[Music]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E9%9F%B3%E4%B9%90%E5%88%86%E4%BA%AB-
[Contact]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E6%8E%A8%E8%8D%90%E5%A5%BD%E5%8F%8B
[Reply]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E5%9B%9E%E5%A4%8D
[Forward]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91-
[Node]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91%E8%8A%82%E7%82%B9-
[Xml]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#xml-%E6%B6%88%E6%81%AF
[Json]: https://github.com/botuniverse/onebot-11/blob/master/message/segment.md#json-%E6%B6%88%E6%81%AF
</Details>
<Details>
<Summary>API</Summary>
2023-10-17 06:16:17 +02:00
| API | Support |
| -------------------------- | :-----: |
| [/send_private_msg] | 🔴 |
| [/send_group_msg] | 🔴 |
| [/send_msg] | 🟢 |
| [/delete_msg] | 🔴 |
| [/get_msg] | 🔴 |
| [/get_forward_msg] | 🔴 |
| ~~[/send_like]~~ | 🔴 |
| [/set_group_kick] | 🟢 |
| [/set_group_ban] | 🟢 |
| [/set_group_anonymous_ban] | 🔴 |
| [/set_group_whole_ban] | 🟢 |
| [/set_group_admin] | 🟢 |
| [/set_group_anonymous] | 🔴 |
| [/set_group_card] | 🟢 |
| [/set_group_name] | 🟢 |
| [/set_group_leave] | 🟢 |
| [/set_group_special_title] | 🔴 |
| [/set_friend_add_request] | 🔴 |
| [/set_group_add_request] | 🔴 |
| [/get_login_info] | 🟢 |
| [/get_stranger_info] | 🔴 |
| [/get_friend_list] | 🔴 |
| [/get_group_info] | 🟢 |
| [/get_group_list] | 🟢 |
| [/get_group_member_info] | 🔴 |
| [/get_group_member_list] | 🔴 |
| [/get_group_honor_info] | 🔴 |
| [/get_cookies] | 🔴 |
| [/get_csrf_token] | 🔴 |
| [/get_credentials] | 🔴 |
| [/get_record] | 🔴 |
| [/get_image] | 🔴 |
| [/can_send_image] | 🔴 |
| [/can_send_record] | 🔴 |
| [/get_status] | 🔴 |
| [/get_version_info] | 🟢 |
| [/set_restart] | 🔴 |
| [/clean_cache] | 🔴 |
[/send_private_msg]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#send_private_msg-%E5%8F%91%E9%80%81%E7%A7%81%E8%81%8A%E6%B6%88%E6%81%AF
[/send_group_msg]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#send_group_msg-%E5%8F%91%E9%80%81%E7%BE%A4%E6%B6%88%E6%81%AF
[/send_msg]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#send_msg-发送消息
[/delete_msg]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#delete_msg-撤回消息
[/get_msg]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_msg-获取消息
[/get_forward_msg]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_forward_msg-获取合并转发消息
[/send_like]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#send_like-发送好友赞
[/set_group_kick]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_kick-群组踢人
[/set_group_ban]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_ban-群组单人禁言
[/set_group_anonymous_ban]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_anonymous_ban-群组匿名用户禁言
[/set_group_whole_ban]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_whole_ban-群组全员禁言
[/set_group_admin]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_admin-群组设置管理员
[/set_group_anonymous]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_anonymous-群组匿名
[/set_group_card]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_card-设置群名片群备注
[/set_group_name]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_name-设置群名
[/set_group_leave]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_leave-退出群组
[/set_group_special_title]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_special_title-设置群组专属头衔
[/set_friend_add_request]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_friend_add_request-处理加好友请求
[/set_group_add_request]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_add_request-处理加群请求邀请
[/get_login_info]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_login_info-获取登录号信息
[/get_stranger_info]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_stranger_info-获取陌生人信息
[/get_friend_list]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_friend_list-获取好友列表
[/get_group_info]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_info-获取群信息
[/get_group_list]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_list-获取群列表
[/get_group_member_info]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_member_info-获取群成员信息
[/get_group_member_list]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_member_list-获取群成员列表
[/get_group_honor_info]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_honor_info-获取群荣誉信息
[/get_cookies]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_cookies-获取-cookies
[/get_csrf_token]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_csrf_token-获取-csrf-token
[/get_credentials]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_credentials-获取-qq-相关接口凭证
[/get_record]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_record-获取语音
[/get_image]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_image-获取图片
[/can_send_image]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#can_send_image-检查是否可以发送图片
[/can_send_record]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#can_send_record-检查是否可以发送语音
[/get_status]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_status-获取运行状态
[/get_version_info]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_version_info-获取版本信息
[/set_restart]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_restart-重启-onebot-实现
[/clean_cache]: https://github.com/botuniverse/onebot-11/blob/master/api/public.md#clean_cache-清理缓存
</Details>
<Details>
<Summary>Event</Summary>
2023-10-17 06:16:17 +02:00
| PostType | EventName | Support |
| -------- | ------------------------------ | :-----: |
| Message | [Private Message] | 🔴 |
| Message | [Group Message] | 🟢 |
| Notice | [Group File Upload] | 🔴 |
| Notice | [Group Admin Change] | 🔴 |
| Notice | [Group Member Decrease] | 🔴 |
| Notice | [Group Member Increase] | 🔴 |
| Notice | [Group Mute] | 🔴 |
| Notice | [Friend Add] | 🔴 |
| Notice | [Group Recall Message] | 🔴 |
| Notice | [Friend Recall Message] | 🔴 |
| Notice | [Group Poke] | 🔴 |
| Notice | [Group red envelope luck king] | 🔴 |
| Notice | [Group Member Honor Changed] | 🔴 |
| Request | [Add Friend Request] | 🔴 |
| Request | [Group Request/Invitations] | 🔴 |
| Meta | [LifeCycle] | 🟢 |
| Meta | [Heartbeat] | 🟢 |
[Private Message]: https://github.com/botuniverse/onebot-11/blob/master/event/message.md#%E7%A7%81%E8%81%8A%E6%B6%88%E6%81%AF
[Group Message]: https://github.com/botuniverse/onebot-11/blob/master/event/message.md#%E7%BE%A4%E6%B6%88%E6%81%AF
[Group File Upload]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0
[Group Admin Change]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E7%AE%A1%E7%90%86%E5%91%98%E5%8F%98%E5%8A%A8
[Group Member Decrease]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E6%88%90%E5%91%98%E5%87%8F%E5%B0%91
[Group Member Increase]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E6%88%90%E5%91%98%E5%A2%9E%E5%8A%A0
[Group Mute]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E7%A6%81%E8%A8%80
[Friend Add]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E5%A5%BD%E5%8F%8B%E6%B7%BB%E5%8A%A0
[Group Recall Message]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E6%B6%88%E6%81%AF%E6%92%A4%E5%9B%9E
[Friend Recall Message]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E5%A5%BD%E5%8F%8B%E6%B6%88%E6%81%AF%E6%92%A4%E5%9B%9E
[Group Poke]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E5%86%85%E6%88%B3%E4%B8%80%E6%88%B3
2023-10-14 05:46:26 +02:00
[Group red envelope luck king]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E7%BA%A2%E5%8C%85%E8%BF%90%E6%B0%94%E7%8E%8B
[Group Member Honor Changed]: https://github.com/botuniverse/onebot-11/blob/master/event/notice.md#%E7%BE%A4%E6%88%90%E5%91%98%E8%8D%A3%E8%AA%89%E5%8F%98%E6%9B%B4
[Add Friend Request]: https://github.com/botuniverse/onebot-11/blob/master/event/request.md#%E5%8A%A0%E5%A5%BD%E5%8F%8B%E8%AF%B7%E6%B1%82
[Group Request/Invitations]: https://github.com/botuniverse/onebot-11/blob/master/event/request.md#%E5%8A%A0%E7%BE%A4%E8%AF%B7%E6%B1%82%E9%82%80%E8%AF%B7
[LifeCycle]: https://github.com/botuniverse/onebot-11/blob/master/event/meta.md#%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F
[Heartbeat]: https://github.com/botuniverse/onebot-11/blob/master/event/meta.md#%E5%BF%83%E8%B7%B3
</Details>
2023-10-17 06:16:17 +02:00
<Details>
<Summary>Communication</Summary>
| CommunicationType | Support |
| ------------------ | :-----: |
| [Http] | 🔴 |
| [Http-Post] | 🟢 |
| [ForwardWebSocket] | 🟢 |
| [ReverseWebSocket] | 🟢 |
[Http]: https://github.com/botuniverse/onebot-11/blob/master/communication/http.md
[Http-Post]: https://github.com/botuniverse/onebot-11/blob/master/communication/http-post.md
[ForwardWebSocket]: https://github.com/botuniverse/onebot-11/blob/master/communication/ws.md
[ReverseWebSocket]: https://github.com/botuniverse/onebot-11/blob/master/communication/ws-reverse.md
</Details>
2023-10-16 15:24:36 +02:00
#### appsettings.json Example
2023-10-17 06:16:17 +02:00
```json
2023-10-16 15:24:36 +02:00
{
"Logging": {
"LogLevel": {
"Default": "Trace",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AccessToken": "",
"Account": {
"Uin": 0,
"Password": "",
"Protocol": "Linux",
"AutoReconnect": true,
"GetOptimumServer": true
},
"Implementation": {
"ForwardWebSocket": {
2023-10-17 06:16:17 +02:00
"Port": 8081,
"HeartBeatIntetval": 5000
2023-10-16 15:24:36 +02:00
},
"ReverseWebSocket": {
"Host": "127.0.0.1",
"Port": 8080,
"Suffix": "/onebot/v11/ws",
2023-10-17 06:16:17 +02:00
"ReconnectInterval": 5000,
2023-10-16 15:24:36 +02:00
"HeartBeatInterval": 5000
},
"Http": {
"Host": "",
"Port": 0,
"EventEnabled": false
},
"HttpPost": {
"Host": "127.0.0.1",
"Port": 8080,
"Suffix": "/onebot/v11/http",
"Timeout": 0
}
}
}
```
2023-10-17 06:16:17 +02:00
- Create a file named 'appsettings.json' under Lagrange.OneBot executable directory
2023-10-18 04:31:12 +02:00
- As the Password is empty here, this indicates that QRCode login is used
2023-10-16 15:24:36 +02:00
- After the QRCode Login, write Uin back to perform EasyLogin
2023-06-28 05:28:39 +02:00
## Known Problem
2023-10-17 06:16:17 +02:00
2023-07-24 18:45:23 +02:00
~~- [ ] Signature Service is currently not established, so the login tend to be failed and return code may be 45, you can establish your own sign service by rewriting the `Signature` static class.~~
Thanks KonataDev/TheSnowfield for Provision of Signature API
2023-08-18 15:17:31 +02:00
- Signature of Windows and macOS is missing, you need to figure out by your self