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

46 lines
1.5 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.misc
2024-08-27 18:44:32 +08:00
import cn.rtast.fancybot.annotations.CommandDescription
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
2024-09-02 11:30:58 +08:00
import cn.rtast.rob.util.ob.MessageChain
import cn.rtast.rob.util.ob.OneBotListener
2024-08-27 18:44:32 +08:00
@CommandDescription("今日人品~")
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
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
2024-08-30 14:24:46 +08:00
if (jrrpManager.isJrrped(message.sender.userId)) {
2024-08-31 22:37:12 +08:00
val msg = MessageChain.Builder()
.addAt(message.sender.userId)
.addText("你今天已经今日人品过啦, 明天再来吧~")
.build()
2024-10-24 16:55:14 +08:00
message.reply(msg)
2024-08-30 14:24:46 +08:00
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-31 22:37:12 +08:00
val msg = MessageChain.Builder()
.addAt(message.sender.userId)
.addText("$scoreDesc($randomPoint)")
.build()
2024-10-24 16:55:14 +08:00
message.reply(msg)
2024-08-27 18:44:32 +08:00
}
}