Skip to main content

CmdrServer

This item only works when running on the server. Server

This is a wrapper service for Evaera's Cmdr module (https://eryn.io/Cmdr/). It provides an easier way to interact with Cmdr and autoboots with Roam's systems.

Properties

PermissionsHandler

CmdrServer.PermissionsHandler: PermissionsHandler

Functions

PromiseCmdr

CmdrServer:PromiseCmdr() → Promise<Cmdr>

Promise that resolves to the Cmdr module data

RegisterCommandFromModule

CmdrServer:RegisterCommandFromModule(
moduleModuleScript--

The module to register the command from

) → Promise<nil>

Registers a command from a module with Cmdr. Command modules must return a table of type CommandModuleData.

-- Commands/Kill.lua
return {
	Name = "kill";
	Aliases = {"slay"};
	Description = "Kills a player or set of players.";
	Group = "Admin"; -- The permission group required to run this command
	Args = {
		{
			Type = "players";
			Name = "victims";
			Description = "The players to kill.";
		},
	};

	-- Executors
	ClientRun = nil, -- No client side needed
	ServerRun = function (context: CommandContext, players: {Player})
		for _, player in pairs(players) do
			if player.Character then
				player.Character:BreakJoints()
			end
		end
		return ("Killed %d players."):format(#players)
	end
}
CmdrServer:RegisterCommandFromModule(script.Parent.Commands.Kill)

ExecuteCommand

CmdrServer:ExecuteCommand(
commandTextstring,
executorPlayer,
options{
Dataany?,
IsHumanboolean
}?
) → ()

Executes a command with Cmdr from the server. Requires a player to be given as a source of the command. If Data is given, it will be available on the server with CommandContext.GetData

local result = CmdrServer:ExecuteCommand("kill Mophyr", Players.Raildex)

RegisterType

CmdrServer:RegisterType(
namestring,--

The name of the type

typeDataTypeDefinition--

The type data to register

) → ()

Registers a type with Cmdr

GetAvailableCommandsForPlayer

CmdrServer:GetAvailableCommandsForPlayer(
playerPlayer--

The player to get commands for

) → {string}--

Array of command names the player can use

Gets all commands available to a specific player

GetCommandInfo

CmdrServer:GetCommandInfo(
commandNamestring--

The name of the command to get info for

) → CommandDefinition?--

The command data, or nil if not found

Gets information about a specific command

GetAllCommands

CmdrServer:GetAllCommands() → {CommandDefinition}--

Array of all registered commands

Gets all registered commands

CommandExists

CmdrServer:CommandExists(
commandNamestring--

The name of the command to check

) → boolean--

Whether the command exists

Checks if a command exists in the registry

Init

CmdrServer:Init() → ()

Starts Cmdr on the Server

Show raw api
{
    "functions": [
        {
            "name": "PromiseCmdr",
            "desc": "Promise that resolves to the Cmdr module data",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<Cmdr>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 62,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "RegisterCommandFromModule",
            "desc": "Registers a command from a module with Cmdr. Command modules must return a table of type `CommandModuleData`.\n```lua\n-- Commands/Kill.lua\nreturn {\n\tName = \"kill\";\n\tAliases = {\"slay\"};\n\tDescription = \"Kills a player or set of players.\";\n\tGroup = \"Admin\"; -- The permission group required to run this command\n\tArgs = {\n\t\t{\n\t\t\tType = \"players\";\n\t\t\tName = \"victims\";\n\t\t\tDescription = \"The players to kill.\";\n\t\t},\n\t};\n\n\t-- Executors\n\tClientRun = nil, -- No client side needed\n\tServerRun = function (context: CommandContext, players: {Player})\n\t\tfor _, player in pairs(players) do\n\t\t\tif player.Character then\n\t\t\t\tplayer.Character:BreakJoints()\n\t\t\tend\n\t\tend\n\t\treturn (\"Killed %d players.\"):format(#players)\n\tend\n}\n```\n```lua\nCmdrServer:RegisterCommandFromModule(script.Parent.Commands.Kill)\n```",
            "params": [
                {
                    "name": "module",
                    "desc": "The module to register the command from",
                    "lua_type": "ModuleScript"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<nil>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 101,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "ExecuteCommand",
            "desc": "Executes a command with Cmdr from the server. Requires a player to be given as a source of the command.\nIf `Data` is given, it will be available on the server with `CommandContext.GetData`\n\n```lua\nlocal result = CmdrServer:ExecuteCommand(\"kill Mophyr\", Players.Raildex)\n```",
            "params": [
                {
                    "name": "commandText",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "executor",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "{ Data: any?, IsHuman: boolean }?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 135,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "RegisterType",
            "desc": "Registers a type with Cmdr",
            "params": [
                {
                    "name": "name",
                    "desc": "The name of the type",
                    "lua_type": "string"
                },
                {
                    "name": "typeData",
                    "desc": "The type data to register",
                    "lua_type": "TypeDefinition"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 147,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "RegisterCommand",
            "desc": "This method is deprecated\nRegisters a command with Cmdr. This method does not support client-side execution.\nOriginally ported from Quenty's wrapper for Cmdr.",
            "params": [
                {
                    "name": "commandData",
                    "desc": "The command data to register",
                    "lua_type": "CommandDefinition"
                },
                {
                    "name": "commandServerExecutor",
                    "desc": "The server function to execute when the command is run",
                    "lua_type": "((context: table, ...any) -> ())?\n"
                }
            ],
            "returns": [],
            "function_type": "method",
            "private": true,
            "unreleased": true,
            "source": {
                "line": 160,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "GetAvailableCommandsForPlayer",
            "desc": "Gets all commands available to a specific player",
            "params": [
                {
                    "name": "player",
                    "desc": "The player to get commands for",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "Array of command names the player can use",
                    "lua_type": "{string}"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 204,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "GetCommandInfo",
            "desc": "Gets information about a specific command",
            "params": [
                {
                    "name": "commandName",
                    "desc": "The name of the command to get info for",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "The command data, or nil if not found",
                    "lua_type": "CommandDefinition?"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 222,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "GetAllCommands",
            "desc": "Gets all registered commands",
            "params": [],
            "returns": [
                {
                    "desc": "Array of all registered commands",
                    "lua_type": "{CommandDefinition}"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 230,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "CommandExists",
            "desc": "Checks if a command exists in the registry",
            "params": [
                {
                    "name": "commandName",
                    "desc": "The name of the command to check",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Whether the command exists",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 239,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "__executeCommand",
            "desc": "Private function used by the execution template to retrieve the execution function.",
            "params": [
                {
                    "name": "cmdrCommandId",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 254,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "_getRawGroupPerms",
            "desc": "",
            "params": [
                {
                    "name": "groupId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ string }\n"
                }
            ],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 269,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        },
        {
            "name": "Init",
            "desc": "Starts Cmdr on the Server",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 281,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "PermissionsHandler",
            "desc": "",
            "lua_type": "PermissionsHandler",
            "source": {
                "line": 56,
                "path": "lib/cmdrhandler/src/Server/init.luau"
            }
        }
    ],
    "types": [],
    "name": "CmdrServer",
    "desc": "This is a wrapper service for Evaera's Cmdr module (https://eryn.io/Cmdr/).\nIt provides an easier way to interact with Cmdr and autoboots with Roam's\nsystems.",
    "realm": [
        "Server"
    ],
    "source": {
        "line": 11,
        "path": "lib/cmdrhandler/src/Server/init.luau"
    }
}