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
194a2437
Commit
194a2437
authored
Nov 28, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify examples
parent
7ef667d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
README.md
README.md
+6
-6
No files found.
README.md
View file @
194a2437
...
...
@@ -45,15 +45,15 @@ implementation("net.mamoe:mirai-core-android:VERSION")
现在您可以开始体验低付出高效率的 Mirai
```
kotlin
val
bot
=
Bot
(
qqId
,
password
).
a
pply
{
login
().
requireSuccess
()
}
// 创建一个机器人实例并登录
bot
.
subscribeMessages
{
// 订阅消息事件
"你好"
reply
"你好!"
// 收到 "你好" 则回复 "你好!"
"profile"
reply
{
sender
.
profile
.
await
().
toString
()
}
// 收到 "profile" 则回复发送者的个人资料
contains
(
"图片"
){
File
(
imagePath
).
send
()
}
// 收到消息包含 "图片" 就回复一张本地的图片
val
bot
=
Bot
(
qqId
,
password
).
a
lsoLogin
()
bot
.
subscribeMessages
{
"你好"
reply
"你好!"
"profile"
reply
{
sender
.
queryProfile
()
}
contains
(
"图片"
){
File
(
imagePath
).
send
()
}
}
bot
.
subscribeAlways
<
MemberPermissionChangedEvent
>
{
if
(
it
.
kind
==
BECOME_OPERATOR
)
it
.
group
.
sendMessage
(
"${it.member.id} 成为了管理员"
)
reply
(
"${it.member.id} 成为了管理员"
)
}
```
...
...
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