Commands Contract
Contract: ICommands
Default provider: shiva-commands
Registers chat commands with permission checking and tab completion.
Methods
ICommands:register(name, opts)
Register a command.
lua
local commands = container:make('ICommands')
commands:register('givemoney', {
description = 'Give a player money',
permission = 'admin',
params = {
{ name = 'target', type = 'number', help = 'Player ID' },
{ name = 'account', type = 'string', help = 'Account name' },
{ name = 'amount', type = 'number', help = 'Amount' },
},
handler = function(source, args)
-- args.target, args.account, args.amount are typed and validated
end,
})ICommands:remove(name)
Unregister a command.
ICommands:list()
Get all registered commands.
Returns: table