2020-12-19 11:15:57 +08:00
|
|
|
|
# Mirai
|
|
|
|
|
|
2021-04-11 22:35:03 +08:00
|
|
|
|
欢迎来到 mirai 开发文档。
|
2020-12-19 11:15:57 +08:00
|
|
|
|
|
2021-04-11 22:35:03 +08:00
|
|
|
|
本文面向要进行开发的用户。对于只使用现成插件的用户,请阅读 [用户手册](UserManual.md)。
|
2020-12-19 11:15:57 +08:00
|
|
|
|
|
2021-04-11 22:35:03 +08:00
|
|
|
|
[Mirai 生态概览](mirai-ecology.md)
|
2020-12-19 11:15:57 +08:00
|
|
|
|
|
2021-06-03 23:07:12 +08:00
|
|
|
|
[Mirai VuePress 文档](https://docs.mirai.mamoe.net/)
|
|
|
|
|
|
2021-01-24 15:59:54 +08:00
|
|
|
|
## 社区 SDK
|
2020-12-19 11:41:48 +08:00
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
**mirai 官方提供 [Kotlin/Java 等 JVM 平台语言开发支持](#jvm-平台-mirai-开发)
|
|
|
|
|
。如果不熟悉这些语言,请使用以下社区 SDK:**
|
2020-12-19 11:41:48 +08:00
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
要使用这些社区 SDK 需要先配置 Mirai
|
|
|
|
|
Console,可以使用 [一键安装](https://mirai.mamoe.net/assets/uploads/files/1618372079496-install-20210412.cmd)(32位,带
|
|
|
|
|
HTTP 插件),也可以阅读 [用户手册](UserManual.md) 进行个性化安装。
|
2021-04-11 22:35:03 +08:00
|
|
|
|
|
|
|
|
|
你可以使用一个或多个语言来开发插件,而且在自己开发的同时也可以[使用下载的插件](UserManual.md#下载和安装插件)。
|
2020-12-19 11:41:48 +08:00
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
[`mirai-console`]: ../mirai-console
|
2020-12-19 11:41:48 +08:00
|
|
|
|
|
|
|
|
|
[mamoe/mirai-api-http]: https://github.com/mamoe/mirai-api-http
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[iTXTech/mirai-native]: https://github.com/iTXTech/mirai-native
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[iTXTech/mirai-js]: https://github.com/iTXTech/mirai-js
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-01-24 15:59:54 +08:00
|
|
|
|
[iTXTech/mirai-kts]: https://github.com/iTXTech/mirai-kts
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-10-17 10:52:43 +08:00
|
|
|
|
[GraiaProject/Ariadne]: https://github.com/GraiaProject/Ariadne
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-09-05 00:09:10 +08:00
|
|
|
|
[GraiaProject/Avilla]: https://github.com/GraiaProject/Avilla
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-09-21 15:34:02 +08:00
|
|
|
|
[Elaina]: https://github.com/wyapx/Elaina
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2022-01-29 00:46:05 +08:00
|
|
|
|
[ArcletProject/Edoves]: https://github.com/ArcletProject/Edoves
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-02-03 10:25:24 +08:00
|
|
|
|
[NoneBot]: https://github.com/nonebot/nonebot2
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[RedBeanN/node-mirai]: https://github.com/RedBeanN/node-mirai
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[Logiase/gomirai]: https://github.com/Logiase/gomirai
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[cyanray/mirai-cpp]: https://github.com/cyanray/mirai-cpp
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[Chlorie/miraipp]: https://github.com/Chlorie/miraipp-template
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[Executor-Cheng/mirai-CSharp]: https://github.com/Executor-Cheng/mirai-CSharp
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[HoshinoTented/mirai-rs]: https://github.com/HoshinoTented/mirai-rs
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[YunYouJun/mirai-ts]: https://github.com/YunYouJun/mirai-ts
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-09-27 23:26:11 +08:00
|
|
|
|
[nepsyn/miraipie]: https://github.com/nepsyn/miraipie
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[only52607/e-mirai]: https://github.com/only52607/e-mirai
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2020-12-19 11:41:48 +08:00
|
|
|
|
[theGravityLab/ProjHyperai]: https://github.com/theGravityLab/ProjHyperai
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-01-24 15:33:19 +08:00
|
|
|
|
[yyuueexxiinngg/onebot-kotlin]: https://github.com/yyuueexxiinngg/onebot-kotlin
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-01-24 15:33:19 +08:00
|
|
|
|
[Nambers/MiraiCP]:https://github.com/Nambers/MiraiCP
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-02-03 18:03:36 +08:00
|
|
|
|
[drinkal/Mirai-js]:https://github.com/drinkal/Mirai-js
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-04-09 12:31:41 +08:00
|
|
|
|
[Coloryr/ColorMirai]: https://github.com/Coloryr/ColorMirai
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-06-08 11:24:54 +08:00
|
|
|
|
[AHpxChina/Mirai.Net]: https://github.com/AHpxChina/Mirai.Net
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-07-29 16:21:48 +08:00
|
|
|
|
[Miyakowww/CocoaFramework2]: https://github.com/Miyakowww/CocoaFramework2
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-06-08 11:28:29 +08:00
|
|
|
|
[Shimogawa/rubirai]: https://github.com/Shimogawa/rubirai
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-07-14 04:23:53 +08:00
|
|
|
|
[Excaive/miraicle]: https://github.com/Excaive/miraicle
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-08-01 22:24:25 +08:00
|
|
|
|
[nkxingxh/miraiez]: https://github.com/nkxingxh/miraiez
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-11-25 20:33:23 +08:00
|
|
|
|
[Xwdit/RainyBot-Core]: https://github.com/Xwdit/RainyBot-Core
|
2021-01-24 15:33:19 +08:00
|
|
|
|
|
|
|
|
|
[OneBot]: https://github.com/howmanybots/onebot
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-04-11 22:35:03 +08:00
|
|
|
|
[Mirai HTTP]: https://github.com/project-mirai/mirai-api-http
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-04-27 10:41:27 +08:00
|
|
|
|
[jerrita/saaya]: https://github.com/jerrita/saaya
|
2021-12-06 20:53:07 +08:00
|
|
|
|
|
2021-07-12 21:40:53 +08:00
|
|
|
|
[YiriMirai]: https://github.com/YiriMiraiProject/YiriMirai
|
2021-04-11 22:35:03 +08:00
|
|
|
|
|
2022-02-27 23:14:27 +08:00
|
|
|
|
[MiraiBots.jl]: https://github.com/melonedo/MiraiBots.jl
|
|
|
|
|
|
2021-04-11 22:35:03 +08:00
|
|
|
|
### 原生接口
|
|
|
|
|
|
|
|
|
|
这些接口直接在 JVM 上实现,不需要中间件,拥有更佳的性能。
|
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
| 技术 | 维护者及项目地址 |
|
2021-04-11 22:35:03 +08:00
|
|
|
|
|:-------------------|:-----------------------|
|
|
|
|
|
| `Kotlin Scripting` | [iTXTech/mirai-kts] |
|
|
|
|
|
| `C++` | [Nambers/MiraiCP] |
|
|
|
|
|
| `JavaScript` | [iTXTech/mirai-js] |
|
2021-12-06 20:53:07 +08:00
|
|
|
|
| *酷 Q DLL 插件* | [iTXTech/mirai-native] |
|
2021-04-11 22:35:03 +08:00
|
|
|
|
|
|
|
|
|
### HTTP 接口
|
|
|
|
|
|
|
|
|
|
目前有两个 HTTP 协议插件。使用 HTTP 协议插件可以支持更多编程语言和技术。
|
|
|
|
|
|
|
|
|
|
- [***Mirai HTTP***][Mirai HTTP] 由 Mirai 开发团队提供第一级支持,目前多数 SDK 都基于它;
|
2021-11-06 18:22:03 +08:00
|
|
|
|
- [OneBot] 标准则兼容酷Q协议,可以让基于酷Q HTTP 插件的项目在 Mirai 平台运行。
|
2021-04-11 22:35:03 +08:00
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
| 名称 | 实现 | 维护者及项目地址 |
|
|
|
|
|
|:-----------------|:------------|:-------------------------------|
|
2021-04-11 22:35:03 +08:00
|
|
|
|
| ***Mirai Http*** | Mirai 标准 | [mamoe/mirai-api-http] |
|
|
|
|
|
| *OneBot Http* | [OneBot] 标准 | [yyuueexxiinngg/onebot-kotlin] |
|
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
下表列举基于 Mirai HTTP
|
|
|
|
|
插件实现对一些编程语言支持的项目列表。要使用它们,你需要[在 Mirai Console 安装 `mirai-api-http`](https://github.com/project-mirai/mirai-api-http#%E5%AE%89%E8%A3%85mirai-api-http)(如果使用上面的一键安装则不需要额外操作)。
|
|
|
|
|
|
|
|
|
|
| 语言和技术 | 维护者及项目地址 |
|
|
|
|
|
|:--------------------------|:-------------------------------------|
|
|
|
|
|
| `C#` | [Executor-Cheng/mirai-CSharp] |
|
|
|
|
|
| `C#` | [Hyperai][theGravityLab/ProjHyperai] |
|
|
|
|
|
| `C#` | [Coloryr/ColorMirai] |
|
|
|
|
|
| `C#` | [AhpxChina/Mirai.Net] |
|
|
|
|
|
| `C#` | [Miyakowww/CocoaFramework2] |
|
|
|
|
|
| `C++` | [cyanray/mirai-cpp] |
|
|
|
|
|
| `C++` | [Chlorie/miraipp] |
|
|
|
|
|
| `GDScript` | [Xwdit/RainyBot-Core] |
|
|
|
|
|
| `Go` | [Logiase/gomirai] |
|
|
|
|
|
| `JavaScript` / Node.js | [RedBeanN/node-mirai] |
|
|
|
|
|
| `JavaScript` / Node.js | [drinkal/Mirai-js] |
|
|
|
|
|
| `JavaScript` / TypeScript | [YunYouJun/mirai-ts] |
|
|
|
|
|
| `JavaScript` / TypeScript | [nepsyn/miraipie] |
|
2022-02-27 23:14:27 +08:00
|
|
|
|
| `Julia` | [MiraiBots.jl] |
|
2021-12-06 20:53:07 +08:00
|
|
|
|
| `PHP` | [nkxingxh/miraiez] |
|
|
|
|
|
| `Python` | [Ariadne][GraiaProject/Ariadne] |
|
|
|
|
|
| `Python` | [Avilla][GraiaProject/Avilla] |
|
2022-01-29 00:46:05 +08:00
|
|
|
|
| `Python` | [Edoves][ArcletProject/Edoves] |
|
2021-12-06 20:53:07 +08:00
|
|
|
|
| `Python` | [Elaina] |
|
|
|
|
|
| `Python` | [NoneBot] |
|
|
|
|
|
| `Python` | [jerrita/saaya] |
|
|
|
|
|
| `Python` | [YiriMirai] |
|
|
|
|
|
| `Python` | [Excaive/miraicle] |
|
|
|
|
|
| `Ruby` | [Shimogawa/rubirai] |
|
|
|
|
|
| `Rust` | [HoshinoTented/mirai-rs] |
|
|
|
|
|
| `易语言` | [only52607/e-mirai] |
|
2020-12-19 11:41:48 +08:00
|
|
|
|
|
2021-08-01 22:30:48 +08:00
|
|
|
|
> 按字母顺序排序,排序不代表排名
|
2021-01-11 21:24:32 +08:00
|
|
|
|
> *想在这里添加你的项目?欢迎[提交 PR](https://github.com/mamoe/mirai/edit/dev/docs/README.md)。*
|
2020-12-31 18:51:36 +08:00
|
|
|
|
|
2021-01-11 21:24:32 +08:00
|
|
|
|
特别地,有一些 SDK 直接基于 mirai-core 开发,不需要 [`mirai-console`]:
|
2020-12-19 11:43:30 +08:00
|
|
|
|
|
2021-01-11 21:24:32 +08:00
|
|
|
|
- `Lua`: [lua-mirai](https://github.com/only52607/lua-mirai)
|
2020-12-19 11:43:30 +08:00
|
|
|
|
|
2021-01-11 21:11:33 +08:00
|
|
|
|
## JVM 平台 Mirai 开发
|
|
|
|
|
|
2021-04-11 22:35:03 +08:00
|
|
|
|
本节介绍使用 Java、Kotlin 等 JVM 平台编程语言开发 Mirai 或 Mirai Console 插件。
|
|
|
|
|
|
2021-03-21 11:35:23 +08:00
|
|
|
|
**为了避免遇到各种问题,请逐步仔细阅读。**
|
2021-01-11 21:11:33 +08:00
|
|
|
|
|
2021-03-21 11:35:23 +08:00
|
|
|
|
1. [JVM 环境和开发准备工作](Preparations.md#mirai---preparations)
|
2021-03-18 09:38:34 +08:00
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
2. 选择框架 建议先阅读 [Mirai 生态概览](mirai-ecology.md)。
|
2021-04-11 22:35:03 +08:00
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
- 若要将 mirai 当做依赖库嵌入你的应用使用(你调用 mirai),则需要使用
|
|
|
|
|
mirai-core,请阅读 [配置项目依赖](ConfiguringProjects.md)。
|
2021-03-21 11:35:23 +08:00
|
|
|
|
|
2021-12-06 20:53:07 +08:00
|
|
|
|
- 若要以插件模式开发(mirai 调用你),可以使用
|
|
|
|
|
mirai-console,请阅读 [mirai-console 的配置插件项目](../mirai-console/docs/ConfiguringProjects.md)
|
|
|
|
|
。
|
2021-03-21 11:35:23 +08:00
|
|
|
|
|
|
|
|
|
4. 阅读 API 文档(见下文)
|
2020-12-19 11:15:57 +08:00
|
|
|
|
|
2021-01-11 21:11:33 +08:00
|
|
|
|
> 如果你希望先确认 mirai 能够正常运行才能安心阅读文档,可克隆 [mirai-hello-world](https://github.com/project-mirai/mirai-hello-world) 并运行其中 Kotlin 或 Java 入口点 `main`。
|
2020-12-19 11:15:57 +08:00
|
|
|
|
|
|
|
|
|
|
2021-03-18 09:38:34 +08:00
|
|
|
|
之后...
|
|
|
|
|
|
|
|
|
|
- [让更多人看到你的项目 - 在论坛发布](https://mirai.mamoe.net/category/6/%E9%A1%B9%E7%9B%AE%E5%8F%91%E5%B8%83)
|
|
|
|
|
|
2021-01-11 21:11:33 +08:00
|
|
|
|
### mirai-core API 文档
|
2020-12-19 11:15:57 +08:00
|
|
|
|
|
2021-04-14 11:49:34 +08:00
|
|
|
|
请在 [CoreAPI.md](CoreAPI.md) 阅读 JVM 平台的 mirai-core-api 使用文档。
|
2022-01-21 08:28:43 +08:00
|
|
|
|
|
|
|
|
|
### mirai-core API KDoc
|
|
|
|
|
|
|
|
|
|
可在 https://github.com/project-mirai/mirai-doc 查看 KDoc。
|