feat: add zibi command
This commit is contained in:
3 files changed
+37
-3
No files matched your search
@@ -159,7 +159,7 @@ val commands = listOf(
|
||||
CompilerCommand(), GPTCommand(),
|
||||
GithubUserCommand(), AboutCommand(),
|
||||
MusicPlayUrlCommand(), DomainPriceCommand(),
|
||||
SendMailCommand()
|
||||
SendMailCommand(), ZiBiCommand()
|
||||
)
|
||||
|
||||
suspend fun main() {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user