#Command Autocompletion
6 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Bump.
a simple example. Not proved of typing issues.
In the KJS wiki, you find some more information
ServerEvents.commandRegistry(e => {
const { commands: Commands, arguments: Arguments } = e
e.register(Commands.literal('kit')
.requires(s => s.hasPermission(2))
.then(Commands.literal('kit_name_a')
.requires(s => s.hasPermission(2))
.executes(c => kitA(c.source.server))
)
.then(Commands.literal('kit_name_n')
.requires(s => s.hasPermission(2))
.executes(c => kitB(c.source.server))
)
)
function kitA (server) {
//..your code here
}
function kitB (server) {
//..your code here
}
})
Oh it's that simple? I was going with the approach of using Command.argument with an argument creator and then a switch case with the string 😭
Thank you for the answer! :D