graphmine-core / io.github.sof3.graphmine.command / Command
abstract class Command<C : Scope>
This class represents a command type. Each instance of Command should represent one registered command.
Subclasses must initialize the name property.
/**
* Implements the /version command
*/
object VersionCommand : Command<Server>({
name = "graphmine.version".qualify()
aliases += "v"
description = CoreLang.commands.version.description(Unit)
handle<EmptyOverload, CommandSender> {
respond(CoreLang.commands.version.response(VersionResponse(VersionInfo.VERSION)))
}
})
fn - A lambda to initialize the command.
| <init> | Command(fn: Command<C>.() -> Unit)This class represents a command type. Each instance of Command should represent one registered command. |
| aliases | var aliases: List<String>The list of aliases |
| description | var description: I18nThe description of the command, shown in action lists like /help. |
| name | lateinit var name: QualifierThe qualified name of the command. |
| scope | lateinit var scope: CThe scope that owns the command |
| dispatch | fun dispatch(reader: FormattedStringReader, sender: CommandSender, receiver: CommandReceiver): JobExecutes the command. |
| handle | fun <A : Overload, S : CommandSender> handle(fn: suspend CommandExecutor<A, S, C>.() -> Unit): UnitAdds a handler to the command. |
| VersionCommand | object VersionCommand : Command<Server>Implements the /version command |