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
6f498554
Commit
6f498554
authored
Nov 02, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update README.md
parent
a28528df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
README.md
README.md
+17
-3
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/FriendEvents.kt
...nMain/kotlin/net.mamoe.mirai/event/events/FriendEvents.kt
+1
-7
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
...rai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
+0
-1
No files found.
README.md
View file @
6f498554
...
...
@@ -15,9 +15,22 @@ Mirai 在 JVM 平台采用插件模式运行,同时提供独立的跨平台核
现在您可以开始体验低付出高效率的 Mirai
```
kotlin
val
bot
=
Bot
(
qqId
,
password
).
apply
{
login
().
requireSuccess
()
}
// 创建一个机器人实例并登录
bot
.
subscribeMessages
{
// 订阅消息事件
"你好"
reply
"你好!"
// 收到 "你好" 则回复 "你好!"
"profile"
reply
{
sender
.
profile
.
await
().
toString
()
}
// 收到 "profile" 则回复发送者的个人资料
contains
(
"图片"
){
File
(
imagePath
).
send
()
}
// 收到消息包含 "图片" 就回复一张本地的图片
}
bot
.
subscribeAlways
<
MemberPermissionChangedEvent
>
{
if
(
it
.
kind
==
BECOME_OPERATOR
)
it
.
group
.
sendMessage
(
"${it.member.id} 成为了管理员"
)
}
```
1.
Clone
2.
Import as Gradle project
3.
Run demo main
[
Demo 1 Main
](
mirai-demos/mirai-demo-1/src/main/java/demo/subscribe/SubscribeSamples.kt
)
3.
运行 Demo 程序:
[
mirai-demo
](
#mirai-demo
)
示例和演示程序
**转到[开发文档](#Development-Guide---Kotlin)**
...
...
@@ -106,8 +119,9 @@ Mirai 的核心部分.
-
Jar 插件支持
#### mirai-demo
Samples and demos.
目前仅有
[
SubscribeSamples
](
mirai-demos/mirai-demo-1/src/main/java/demo/subscribe/SubscribeSamples.kt
)
Samples and demos.
监听事件示例
[
SubscribeSamples
](
mirai-demos/mirai-demo-1/src/main/java/demo/subscribe/SubscribeSamples.kt
)
随机图片发送
[
Gentleman
](
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
)
#### mirai-debug
抓包工具和分析工具. 不会进行稳定性维护.
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/FriendEvents.kt
View file @
6f498554
...
...
@@ -3,7 +3,6 @@
package
net.mamoe.mirai.event.events
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.contact.Profile
import
net.mamoe.mirai.contact.QQ
import
net.mamoe.mirai.message.Message
import
net.mamoe.mirai.message.MessageChain
...
...
@@ -35,9 +34,4 @@ class FriendConversationInitializedEvent(bot: Bot, sender: QQ) : FriendEvent(bot
/**
* 好友在线状态改变事件
*/
class
FriendOnlineStatusChangedEvent
(
bot
:
Bot
,
sender
:
QQ
,
val
newStatus
:
OnlineStatus
)
:
FriendEvent
(
bot
,
sender
)
/**
* 好友个人资料更新
*/
class
FriendProfileUpdatedEvent
(
bot
:
Bot
,
qq
:
QQ
,
val
profile
:
Profile
)
:
FriendEvent
(
bot
,
qq
)
\ No newline at end of file
class
FriendOnlineStatusChangedEvent
(
bot
:
Bot
,
sender
:
QQ
,
val
newStatus
:
OnlineStatus
)
:
FriendEvent
(
bot
,
sender
)
\ No newline at end of file
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
View file @
6f498554
...
...
@@ -44,7 +44,6 @@ suspend fun main() {
subscribeAlways
<
Event
>
{
//bot.logger.verbose("收到了一个事件: ${it::class.simpleName}")
}
bot
.
subscribeMessages
{
"你好"
reply
"你好!"
"profile"
reply
{
...
...
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