feat: add shuffled echo command

This commit is contained in:
2024-10-15 19:07:18 +08:00
parent 6b4ef38443
commit fbcdbe301a
2 files changed
+17 -1

No files matched your search

@@ -12,6 +12,7 @@ import cn.rtast.fancybot.configManager
import cn.rtast.fancybot.enums.CommandAction
import cn.rtast.fancybot.util.file.insertActionRecord
import cn.rtast.rob.entity.GroupMessage
import cn.rtast.rob.enums.ArrayMessageType
import cn.rtast.rob.util.BaseCommand
import cn.rtast.rob.util.ob.OneBotListener
@@ -27,4 +28,18 @@ class EchoCommand : BaseCommand() {
listener.sendGroupMessage(message.groupId, args.joinToString(" "))
insertActionRecord(CommandAction.Echo, message.sender.userId)
}
}
@CommandDescription("精神错乱(×), 胡言乱语(√)")
class ShuffleEchoCommand : BaseCommand() {
override val commandNames = listOf("/secho", "/se")
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
if (message.sender.userId !in configManager.admins) {
message.reply("你不许用echo")
return
}
message.reply(message.rawMessage.toList().shuffled().joinToString(""))
insertActionRecord(CommandAction.Echo, message.sender.userId)
}
}