diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3accfb1..21e03b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] kotlinVersion = "2.0.10" -ronebotVersion = "1.7.2" +ronebotVersion = "1.8.1" shadowVersion = "8.3.0" okhttpVersion = "5.0.0-alpha.14" exposedVersion = "0.53.0" @@ -17,7 +17,7 @@ exposedCore = { group = "org.jetbrains.exposed", name = "exposed-core", version. exposedJDBC = { group = "org.jetbrains.exposed", name = "exposed-jdbc", version.ref = "exposedVersion" } sqliteJDBC = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqliteJDBCVersion" } animated-gif-lib = { group = "com.madgag", name = "animated-gif-lib", version.ref = "animatedGifLibVersion" } -simple-java-mail = {group="org.simplejavamail", name="simple-java-mail",version.ref="simpleJavaMailVersion"} +simple-java-mail = { group = "org.simplejavamail", name = "simple-java-mail", version.ref = "simpleJavaMailVersion" } [bundles] diff --git a/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt b/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt index 5ab582a..483a3bf 100644 --- a/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt +++ b/src/main/kotlin/cn/rtast/fancybot/FancyBot.kt @@ -159,7 +159,7 @@ val commands = listOf( CompilerCommand(), GPTCommand(), GithubUserCommand(), AboutCommand(), MusicPlayUrlCommand(), DomainPriceCommand(), - SendMailCommand() + SendMailCommand(), ZiBiCommand() ) suspend fun main() { diff --git a/src/main/kotlin/cn/rtast/fancybot/commands/ZiBiCommand.kt b/src/main/kotlin/cn/rtast/fancybot/commands/ZiBiCommand.kt new file mode 100644 index 0000000..77e9f0f --- /dev/null +++ b/src/main/kotlin/cn/rtast/fancybot/commands/ZiBiCommand.kt @@ -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) { + 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) + } + } +} \ No newline at end of file