feat: add poke reply
This commit is contained in:
6 files changed
+21
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
[versions]
|
||||
kotlinVersion = "2.0.10"
|
||||
ronebotVersion = "1.11.3"
|
||||
ronebotVersion = "1.11.4"
|
||||
shadowVersion = "8.3.0"
|
||||
okhttpVersion = "5.0.0-alpha.14"
|
||||
exposedVersion = "0.53.0"
|
||||
|
||||
@@ -64,7 +64,8 @@ val DEFAULT_CONFIG = Config(
|
||||
llamaUrl = "http://127.0.0.1",
|
||||
llamaModel = "llama3.1",
|
||||
qqMusicApiUrl = "http://127.0.0.1:3200",
|
||||
startUpNoticeUser = 114514L
|
||||
startUpNoticeUser = 114514L,
|
||||
selfId = 114514L
|
||||
)
|
||||
|
||||
val configManager = ConfigManager()
|
||||
|
||||
@@ -13,6 +13,7 @@ import cn.rtast.fancybot.util.initDatabase
|
||||
import cn.rtast.rob.ROneBotFactory
|
||||
import cn.rtast.rob.entity.*
|
||||
import cn.rtast.rob.entity.lagrange.FileEvent
|
||||
import cn.rtast.rob.entity.lagrange.PokeEvent
|
||||
import cn.rtast.rob.enums.ArrayMessageType
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
@@ -117,6 +118,18 @@ class FancyBot : OneBotListener {
|
||||
.build()
|
||||
this.sendGroupMessage(groupId, msg)
|
||||
}
|
||||
|
||||
override suspend fun onPoke(event: PokeEvent) {
|
||||
event.groupId?.let {
|
||||
if (event.targetId == configManager.selfId) {
|
||||
val msg = MessageChain.Builder()
|
||||
.addAt(event.userId)
|
||||
.addText("你${event.action.first()}牛魔呢")
|
||||
.build()
|
||||
this.sendGroupMessage(it, msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun initFilesDir() {
|
||||
|
||||
@@ -33,5 +33,6 @@ data class Config(
|
||||
val llamaUrl: String,
|
||||
val llamaModel: String,
|
||||
val qqMusicApiUrl: String,
|
||||
val startUpNoticeUser: Long
|
||||
val startUpNoticeUser: Long,
|
||||
val selfId: Long
|
||||
)
|
||||
@@ -35,4 +35,5 @@ class ConfigManager : JsonFileHandler<Config>("config.json") {
|
||||
val llamaModel = config.llamaModel
|
||||
val qqMusicApiUrl = config.qqMusicApiUrl
|
||||
val startUpNoticeUser = config.startUpNoticeUser
|
||||
val selfId = config.selfId
|
||||
}
|
||||
@@ -26,5 +26,6 @@
|
||||
"llamaUrl": "http://127.0.0.1",
|
||||
"llamaModel": "llama3.1",
|
||||
"qqMusicApiUrl": "http://127.0.0.1:3200",
|
||||
"startUpNoticeUser": 114514
|
||||
"startUpNoticeUser": 114514,
|
||||
"selfId": 114514
|
||||
}
|
||||
Reference in New Issue
Block a user