mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-26 07:20:09 +08:00
update README.md
This commit is contained in:
parent
a28528dfea
commit
6f498554b7
README.md
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman
20
README.md
20
README.md
@ -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
|
||||
抓包工具和分析工具. 不会进行稳定性维护.
|
||||
|
@ -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)
|
||||
class FriendOnlineStatusChangedEvent(bot: Bot, sender: QQ, val newStatus: OnlineStatus) : FriendEvent(bot, sender)
|
@ -44,7 +44,6 @@ suspend fun main() {
|
||||
subscribeAlways<Event> {
|
||||
//bot.logger.verbose("收到了一个事件: ${it::class.simpleName}")
|
||||
}
|
||||
|
||||
bot.subscribeMessages {
|
||||
"你好" reply "你好!"
|
||||
"profile" reply {
|
||||
|
Loading…
Reference in New Issue
Block a user