2019-08-07 18:14:29 +08:00
|
|
|
|
# Mirai
|
2019-09-20 18:16:25 +08:00
|
|
|
|
[![HitCount](http://hits.dwyl.io/him188/mamoe/mirai.svg)](http://hits.dwyl.io/him188/mamoe/mirai)
|
2019-08-08 12:45:12 +08:00
|
|
|
|
|
2019-09-29 20:28:09 +08:00
|
|
|
|
一个以<b>TIM QQ协议(非web)</b>驱动的QQ机器人服务端核心
|
2019-09-16 22:25:55 +08:00
|
|
|
|
采用服务端-插件模式运行,同时提供独立的协议层库
|
2019-10-02 19:13:09 +08:00
|
|
|
|
项目的所有模块均开源
|
2019-08-18 23:19:04 +08:00
|
|
|
|
|
2019-09-16 22:25:55 +08:00
|
|
|
|
项目处于开发阶段,学生无法每日大量更新。
|
2019-09-17 19:09:59 +08:00
|
|
|
|
项目还有很多未完善的地方, 欢迎任何的代码贡献, 或是 issue.
|
|
|
|
|
部分协议来自网络上开源项目
|
2019-10-07 18:14:21 +08:00
|
|
|
|
**一切开发旨在学习,请勿用于非法用途**
|
2019-09-01 01:57:14 +08:00
|
|
|
|
|
2019-09-16 22:25:55 +08:00
|
|
|
|
## 抢先体验
|
|
|
|
|
核心框架结构已经开发完毕,一些核心功能也测试完成。
|
|
|
|
|
仅需几分钟就可以测试 Mirai.
|
|
|
|
|
现在你可以登录小号来测试 Mirai.
|
2019-09-18 17:31:26 +08:00
|
|
|
|
即使测试消息时未发现冻结情况,我们也无法100%保证账号冻结不会发生。
|
2019-09-16 22:25:55 +08:00
|
|
|
|
|
2019-09-08 01:24:18 +08:00
|
|
|
|
1. Clone
|
|
|
|
|
2. Import as Maven project
|
2019-10-07 12:44:44 +08:00
|
|
|
|
3. Run demo[Demo 1 Main](mirai-demos/mirai-demo-1/src/main/java/demo1/Main.kt#L22)
|
2019-09-08 19:29:21 +08:00
|
|
|
|
|
2019-09-11 17:53:56 +08:00
|
|
|
|
### 事件 Hook
|
|
|
|
|
#### Kotlin:
|
2019-10-02 19:13:09 +08:00
|
|
|
|
```kotlin
|
|
|
|
|
FriendMessageEvent.subscribeAlways{
|
|
|
|
|
if(it.message eq "你好")
|
|
|
|
|
it.reply("你好!")
|
2019-09-10 19:56:17 +08:00
|
|
|
|
}
|
|
|
|
|
```
|
2019-09-08 19:58:47 +08:00
|
|
|
|
![AYWVE86P](.github/A%7DYWVE860U%28%25YQD%24R1GB1%5BP.png)
|
|
|
|
|
|
2019-09-10 19:58:41 +08:00
|
|
|
|
### 图片测试
|
2019-09-08 19:58:47 +08:00
|
|
|
|
**现在可以接受图片消息**(并解析为消息链):
|
|
|
|
|
![JsssF](.github/J%5DCE%29IK4BU08%28EO~UVLJ%7B%5BF.png)
|
2019-09-10 21:23:39 +08:00
|
|
|
|
![](.github/68f8fec9.png)
|
2019-09-08 19:58:47 +08:00
|
|
|
|
|
2019-09-16 22:25:55 +08:00
|
|
|
|
发送图片已经完成,但我们还在开发上传图片至服务器。
|
2019-10-07 12:44:44 +08:00
|
|
|
|
现在你可以通过发送一张图片给机器人账号,再让机器人账号发送这张图片。你可以查看 [Image.kt](mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/defaults/Image.kt#L20-L93)
|
2019-09-08 19:29:21 +08:00
|
|
|
|
|
2019-09-10 19:58:41 +08:00
|
|
|
|
# TODO
|
2019-08-24 15:36:59 +08:00
|
|
|
|
- [x] 事件(Event)模块
|
2019-09-08 01:24:18 +08:00
|
|
|
|
- [ ] 插件(Plugin)模块 **(Working on)**
|
2019-08-24 15:36:59 +08:00
|
|
|
|
- [x] Network - Touch
|
2019-09-08 01:32:18 +08:00
|
|
|
|
- [X] Network - Login
|
2019-09-01 22:48:42 +08:00
|
|
|
|
- [X] Network - Session
|
2019-09-07 19:57:32 +08:00
|
|
|
|
- [X] Network - Verification Code
|
2019-09-01 22:48:42 +08:00
|
|
|
|
- [X] Network - Message Receiving
|
|
|
|
|
- [X] Network - Message Sending
|
2019-09-11 19:55:57 +08:00
|
|
|
|
- [ ] Network - Events
|
2019-09-08 20:53:54 +08:00
|
|
|
|
- [ ] Bot - Friend/group list
|
|
|
|
|
- [ ] Bot - Actions(joining group, adding friend, etc.)
|
2019-09-16 22:25:55 +08:00
|
|
|
|
- [x] Message Section
|
2019-09-11 19:55:57 +08:00
|
|
|
|
- [ ] Image uploading **(Working on)**
|
2019-09-01 22:48:42 +08:00
|
|
|
|
- [ ] Contact
|
2019-09-07 19:57:32 +08:00
|
|
|
|
- [ ] UI
|
2019-09-16 22:25:55 +08:00
|
|
|
|
- [ ] Console
|
2019-08-24 15:36:59 +08:00
|
|
|
|
|
2019-08-08 12:45:12 +08:00
|
|
|
|
<br>
|
|
|
|
|
|
2019-09-10 19:58:41 +08:00
|
|
|
|
# 使用方法
|
|
|
|
|
## 要求
|
2019-08-17 13:17:56 +08:00
|
|
|
|
- Java 11 或更高
|
2019-09-01 01:56:40 +08:00
|
|
|
|
- Kotlin 1.3 或更高
|
2019-09-10 19:58:41 +08:00
|
|
|
|
## 插件开发
|
2019-09-08 01:24:18 +08:00
|
|
|
|
``` text
|
2019-09-01 01:48:27 +08:00
|
|
|
|
to be continued
|
2019-08-08 12:51:21 +08:00
|
|
|
|
...
|
|
|
|
|
```
|
|
|
|
|
|
2019-09-18 17:30:11 +08:00
|
|
|
|
# Mirai
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
A JAVA(+Kotlin) powered open-source project under GPL license<br>
|
|
|
|
|
It use protocols from <i>TIM QQ</i>, that is, it won't be affected by the close of <i>Smart QQ</i><br>
|
|
|
|
|
The project is all for <b>learning proposes</b> and still in <b>developing stage</b><br>
|
|
|
|
|
|
2019-09-10 19:58:41 +08:00
|
|
|
|
# Usage
|
|
|
|
|
## Requirements
|
2019-08-17 13:16:15 +08:00
|
|
|
|
- Java 11 or higher
|
2019-09-01 01:56:40 +08:00
|
|
|
|
- Kotlin 1.3 or higher
|
2019-09-10 19:58:41 +08:00
|
|
|
|
## Plugin Development
|
2019-09-08 01:24:18 +08:00
|
|
|
|
``` text
|
2019-09-01 01:48:27 +08:00
|
|
|
|
to be continued
|
2019-08-08 12:51:21 +08:00
|
|
|
|
...
|
|
|
|
|
```
|
2019-08-08 12:45:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|