30 lines
919 B
Kotlin
30 lines
919 B
Kotlin
/*
|
|||
|
|
* Copyright © 2024 RTAkland
|
||
|
|
* Author: RTAkland
|
||
|
|
* Date: 2024/9/3
|
||
|
|
*/
|
||
|
|
|
||
|
|
|
||
|
|
package cn.rtast.fancybot.commands
|
||
|
|
|
||
|
|
import 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 HelpCommand : BaseCommand() {
|
||
|
|
override val commandNames = listOf("/help", "/帮助")
|
||
|
|
|
||
|
|
override suspend fun executeGroup(listener: OBMessage, message: GroupMessage, args: List<String>) {
|
||
|
|
val allCommands = commands.joinToString("\n") {
|
||
|
|
"[${it.javaClass.name.split(".").last().replace("Command", "")}] 命令:${it.commandNames.joinToString(",")}"
|
||
|
|
}
|
||
|
|
val msg = MessageChain.Builder()
|
||
|
|
.addAt(message.sender.userId)
|
||
|
|
.addNewLine()
|
||
|
|
.addText(allCommands)
|
||
|
|
.build()
|
||
|
|
listener.sendGroupMessage(message.groupId, msg)
|
||
|
|
}
|
||
|
|
}
|