Files
FancyBot/src/main/kotlin/cn/rtast/fancybot/commands/JrrpCommand.kt
T

35 lines
1.1 KiB
Kotlin
Raw Normal View History

2024-08-27 18:44:32 +08:00
/*
* Copyright © 2024 RTAkland
* Author: RTAkland
* Date: 2024/8/27
*/
package cn.rtast.fancybot.commands
2024-08-30 14:24:46 +08:00
import cn.rtast.fancybot.util.file.JrrpManager
2024-08-27 18:44:32 +08:00
import cn.rtast.rob.entity.GroupMessage
import cn.rtast.rob.util.BaseCommand
import cn.rtast.rob.util.ob.OBMessage
2024-08-27 19:15:47 +08:00
class JrrpCommand : BaseCommand() {
2024-08-30 15:05:51 +08:00
override val commandNames = listOf("/jrrp", "/今日人品")
2024-08-30 14:24:46 +08:00
private val jrrpManager = JrrpManager()
2024-08-27 18:44:32 +08:00
2024-08-29 14:36:06 +08:00
override suspend fun executeGroup(listener: OBMessage, message: GroupMessage, args: List<String>) {
2024-08-30 14:24:46 +08:00
if (jrrpManager.isJrrped(message.sender.userId)) {
listener.sendGroupMessage(message.groupId, "你今天已经今日人品过啦, 明天再来吧~")
return
}
val randomPoint = jrrpManager.jrrp(message.sender.userId)
val scoreDesc = when (randomPoint) {
2024-08-27 19:15:47 +08:00
in 0..10 -> "人品不太好呢"
in 30..50 -> "人品一般般"
in 70..90 -> "人品还不错哦"
in 90..100 -> "人品超级好呢!"
else -> "人品还行哦"
}
2024-08-30 14:24:46 +08:00
listener.sendGroupMessage(message.groupId, "$scoreDesc($randomPoint)")
2024-08-27 18:44:32 +08:00
}
}