feat: add poke reply

This commit is contained in:
2024-09-28 12:37:18 +08:00
parent bc04c53517
commit 120fc38084
6 files changed
+21 -4

No files matched your search

+2 -1
View File
@@ -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
}