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

44 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
import cn.rtast.fancybot.annotations.CommandDescription
2024-10-19 19:29:53 +08:00
import cn.rtast.fancybot.configManager
2024-10-02 21:02:05 +08:00
import cn.rtast.fancybot.enums.CommandAction
import cn.rtast.fancybot.util.file.insertActionRecord
2024-08-27 18:44:32 +08:00
import cn.rtast.rob.entity.GroupMessage
import cn.rtast.rob.util.BaseCommand
import cn.rtast.rob.util.ob.OneBotListener
2024-08-27 18:44:32 +08:00
@CommandDescription("Echo")
2024-09-03 16:41:06 +08:00
class EchoCommand : BaseCommand() {
2024-08-30 15:05:51 +08:00
override val commandNames = listOf("/echo")
2024-08-27 18:44:32 +08:00
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
2024-10-19 19:29:00 +08:00
if (message.sender.isAdmin || message.sender.isOwner) {
listener.sendGroupMessage(message.groupId, args.joinToString(" "))
insertActionRecord(CommandAction.Echo, message.sender.userId)
} else {
2024-10-04 20:52:54 +08:00
message.reply("你不许用echo")
}
2024-08-27 18:44:32 +08:00
}
2024-10-15 19:07:18 +08:00
}
@CommandDescription("精神错乱(×), 胡言乱语(√)")
class ShuffleEchoCommand : BaseCommand() {
override val commandNames = listOf("/secho", "/se")
override suspend fun executeGroup(listener: OneBotListener, message: GroupMessage, args: List<String>) {
2024-10-19 19:29:00 +08:00
if (message.sender.isAdmin || message.sender.isOwner) {
message.reply(message.rawMessage.toList().shuffled().joinToString(""))
insertActionRecord(CommandAction.Echo, message.sender.userId)
} else{
2024-10-15 19:07:18 +08:00
message.reply("你不许用echo")
}
}
2024-08-27 18:44:32 +08:00
}