Installation
Getting Started
Commander is a flexible and extensible command framework for roblox-ts that makes defining commands easy and readable.
Starting Commander
Commander needs to be started once on the client and server.
CommanderClient.start( (registry) => { // Register commands or types here }, { interface: CommanderInterface({ // You can configure the interface here, such as changing activation keys }),
// The options below are optional
// The maximum terminal and command history length, default length is 1000 historyLength: 1000,
// If you don't want to register built-in types, you can change this option // This is set to true by default registerBuiltInTypes: true, },).catch((err) => warn("Commander could not be started:", tostring(err)));
CommanderServer.start( (registry) => { // Register commands or types here }, { // If you don't want to register built-in types, you can change this option // This is set to true by default. registerBuiltInTypes: true, },).catch((err) => warn("Commander could not be started:", tostring(err)));
Registration
The way commands and types are registered is the same on the server and client.
CommanderServer.start((registry) => { // Register commands by loading all command ModuleScripts under an Instance // You can also use this for types: ModuleScripts that export a function // will be called with the registry object, allowing you to do any // registration there. const commandContainer = script.Parent.commands; registry.register(commandContainer);
// If you've already loaded the command ModuleScripts // (e.g. through Flamework.addPaths) you can register // them like this: registry.registerCommands();
// Type objects are registered like this: registry.registerType(someType); registry.registerTypes(someOtherType, anotherType);}).catch((err) => warn("Commander could not be started:", tostring(err)));