feat: add zibi command

This commit is contained in:
2024-09-18 16:52:28 +08:00
parent 4d22b1ea55
commit d284381554
3 files changed
+37 -3

No files matched your search

@@ -0,0 +1,34 @@
/*
* Copyright © 2024 RTAkland
* Author: RTAkland
* Date: 2024/9/18
*/
package cn.rtast.fancybot.commands
import cn.rtast.rob.entity.GroupMessage
import cn.rtast.rob.util.BaseCommand
import cn.rtast.rob.util.ob.MessageChain
import cn.rtast.rob.util.ob.OBMessage
class ZiBiCommand : BaseCommand() {
override val commandNames = listOf("/自闭", "自闭")
override suspend fun executeGroup(listener: OBMessage, message: GroupMessage, args: List<String>) {
try {
val duration = if (args.isEmpty()) 1 else args.first().toInt()
message.sender.ban(duration * 60)
val msg = MessageChain.Builder()
.addText("你先自闭${duration}分钟吧~")
.build()
message.reply(msg)
} catch (_: Exception) {
val msg = MessageChain.Builder()
.addText("你输入有误所以我决定让你自闭1天~")
.build()
message.reply(msg)
message.sender.ban(86400)
}
}
}