RawCommand
abstract class RawCommand( val owner: CommandOwner, val primaryName: String, val secondaryNames: String, val usage: String = "<no usages given>", val description: String = "<no descriptions given>", parentPermission: Permission = owner.parentPermission, val prefixOptional: Boolean = false) : Command
Content copied to clipboard
无参数解析, 只会接收原消息链的指令. Java 查看 JRawCommand.
object MyCommand : RawCommand(
MyPluginMain, "name", // 使用插件主类对象作为指令拥有者;设置主指令名为 "name"
// 可选:
"name2", "name3", // 增加两个次要名称
usage = "/name arg1 arg2", // 设置用法,将会在 /help 展示
description = "这是一个测试指令", // 设置描述,将会在 /help 展示
prefixOptional = true, // 设置指令前缀是可选的,即使用 `test` 也能执行指令而不需要 `/test`
) {
override suspend fun CommandContext.onCommand(args: MessageChain) {
}
}
Content copied to clipboard
See also
Constructors
Link copied to clipboard
fun RawCommand( owner: CommandOwner, primaryName: String, vararg secondaryNames: String, usage: String = "<no usages given>", description: String = "<no descriptions given>", parentPermission: Permission = owner.parentPermission, prefixOptional: Boolean = false)
Content copied to clipboard
Functions
Properties
Link copied to clipboard
指令描述, 用于显示在 BuiltInCommands.HelpCommand
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard