Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
d59c7165
Commit
d59c7165
authored
Oct 11, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README
parent
e9ad97ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
27 deletions
+5
-27
README.md
README.md
+5
-27
No files found.
README.md
View file @
d59c7165
...
@@ -22,12 +22,12 @@ Mirai 的所有模块均开源
...
@@ -22,12 +22,12 @@ Mirai 的所有模块均开源
3.
Run demo main
[
Demo 1 Main
](
mirai-demos/mirai-demo-1/src/main/java/demo1/Main.kt#L22
)
3.
Run demo main
[
Demo 1 Main
](
mirai-demos/mirai-demo-1/src/main/java/demo1/Main.kt#L22
)
### 事件
### 事件
#### Kotlin
:
#### Kotlin
这里只演示进行不终止地监听。
这里只演示进行不终止地监听。
##### Top-level reified
##### Top-level reified
多数情况下这是最好的方式。
多数情况下这是最好的方式。
```
kotlin
```
kotlin
inline
fun
<
reified
E
:
Event
>
subscribeAlways
(
handler
:
E
->
Unit
)
inline
fun
<
reified
E
:
Event
>
subscribeAlways
(
handler
:
(
E
)
->
Unit
)
subscribeAlways
<
FriendMessageEvent
>{
subscribeAlways
<
FriendMessageEvent
>{
//it: MessageChain
//it: MessageChain
...
@@ -57,7 +57,7 @@ subscribe<FriendMessageEvent>{
...
@@ -57,7 +57,7 @@ subscribe<FriendMessageEvent>{
```
kotlin
```
kotlin
fun
<
E
:
Event
>
KClass
<
E
>.
subscribeAlways
(
listener
:
suspend
(
E
)
->
Unit
)
fun
<
E
:
Event
>
KClass
<
E
>.
subscribeAlways
(
listener
:
suspend
(
E
)
->
Unit
)
FriendMessageEvent
::
class
.
subscribeAlways
{
FriendMessageEvent
::
class
.
subscribeAlways
{
if
(
it
.
message
eq
"你好"
)
if
(
it
.
message
eq
"你好"
)
it
.
reply
(
"你好!"
)
it
.
reply
(
"你好!"
)
}
}
...
@@ -71,7 +71,7 @@ FriendMessageEvent::class.subscribeAlways{
...
@@ -71,7 +71,7 @@ FriendMessageEvent::class.subscribeAlways{


发送图片已经完成,但我们还在开发上传图片至服务器。
发送图片已经完成,但我们还在开发上传图片至服务器。
现在你可以通过发送一张图片给机器人账号,再让机器人账号发送这张图片。你可以查看
[
Image.kt
](
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/
defaults/Image.kt#L20-L93
)
现在你可以通过发送一张图片给机器人账号,再让机器人账号发送这张图片。你可以查看
[
Image.kt
](
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/
Message.kt#L81
)
# TODO
# TODO
-
[x] 事件(Event)模块
-
[x] 事件(Event)模块
...
@@ -102,26 +102,4 @@ FriendMessageEvent::class.subscribeAlways{
...
@@ -102,26 +102,4 @@ FriendMessageEvent::class.subscribeAlways{
```
text
```
text
to be continued
to be continued
...
...
```
```
\ No newline at end of file
# 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>
# Usage
## Requirements
-
Java 11 or higher
-
Kotlin 1.3 or higher
## Plugin Development
```
text
to be continued
...
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment