Orphan command
This page explains how to use orphan commands, which are commands defined without the @Command annotation and whose path will be determined dynamically at runtime.
Overview
What is an OrphanCommand?
OrphanCommand?How to Register an OrphanCommand
OrphanCommandExample Usage
Example
Step 1: Implementing an OrphanCommand
OrphanCommandpublic class Foo implements OrphanCommand {
@CommandPlaceholder
// ^^^
// will get replaced with @Command("the path here")
// at runtime
public void onCommand(CommandActor actor) {
// ...
}
@Subcommand("bar")
public void bar(CommandActor actor) {
actor.reply("Hello!");
}
}class Foo : OrphanCommand {
@CommandPlaceholder
// ^^^
// will get replaced with @Command("the path here")
// at runtime
fun onCommand(actor: CommandActor) {
// ...
}
@Subcommand("bar")
fun bar(actor: CommandActor) {
actor.reply("Hello!")
}
}Step 2: Registering the Orphan Command
Orphans.path() Behavior
Orphans.path() BehaviorSummary
Last updated
Was this helpful?