Cmdr: A fully extensible and type safe command console for Roblox Developers

hi, is there a feature to show presets,

return {
	Name = "modifyCurrency";
	Aliases = {"cash", "changeCash"};
	Description = "Change currency data of a Player.";
	Group = "Admin";
	Args = {
		{
			Type = 'string';
			Name = 'Type';
			Description = 'Type of the data (add/remove/set).';
			Presets = {
				{
					Name = 'add', -- name
					Value = 'ADD' -- will return ADD
				},
				{
					Name = 'remove', -- name
					Value = 'REMOVE' -- will return REMOVE
				},
				{
					Name = 'set', -- name
					Value = 'SET' -- will return SET
				},

			}
		},
		{
			Type = 'player';
			Name = 'Player';
			Description = 'The Player that you will modify his data.';
			
		},
		{
			Type = 'number';
			Name = 'Value';
			Description = 'Value of the data.';

		},
	}
}
1 Like

Hi, I am not sure how to make this type listable. Can anyone help me please? I have looked in the documentation, but there is no way documented to make an Enum type listable.

return function (registry)
	registry:RegisterType("pass", registry.Cmdr.Util.MakeEnumType("Pass", {
			"ROCKETLAUNCHER",
			"VIP",
			"DOUBLEJUMP",
			"GRAVITYCOIL",
			"SPEEDCOIL"
	}))
end

@Pcoi94 If you want to define predetermined values for an argument, you can create an Enum type.


@CSJeverything The Util.MakeEnumType method returns a TypeDefinition, which can be passed as the first argument to the Util.MakeListableType method.

3 Likes

Cmdr v1.12.0 - Bug Fixes, Improvements, and Security Advisory

Hello fellow developers,

We are excited to announce the release of Cmdr v1.12.0! This version brings several bug fixes, quality of life improvements, and a security advisory that requires your immediate attention. Let’s dive into the details:

Changelog

  • Added a new default command: convertTimestamp. It provides a human-readable timestamp from epoch seconds.
  • Introduced built-in types: positiveInteger, nonNegativeInteger, byte (0-255), and digit (0-9), including their respective plural types.
  • Added a json built-in type, which takes a JSON string and provides a Luau table.
  • Implemented internal IsServer assertions for RegisterDefaultCommands and commandServerScript.
  • Updated the help command output with useful ‘tips.’
  • Made the window scroll to the bottom on input.
  • Modified fuzzy finders to search the entire string instead of just the start.
  • Improved the autocomplete menu by making it scrollable.
  • Fixed the window resizing issue that occurred after using the clear command.
  • Removed the global initialization scripts feature.

Security Advisory

Please note that in version 1.12.0, a high-severity security vulnerability (CVSS 7.5) was discovered. This vulnerability affects the var and var= (varSet) commands. If you use Cmdr in a production environment, we urge you to read the security advisory provided at the following link for more information:

Cmdr Security Advisory - GHSA-4vh6-p9hm-qwrr

Summary of the Security Advisory

The bug in the var and var= (varSet) commands allows potential attackers to execute commands on behalf of others, including with those users’ permissions. It is crucial to take immediate action to address this vulnerability and upgrade to the latest version of Cmdr.

To update your Cmdr installation to v1.12.0, please visit the official repository on GitHub:

Cmdr v1.12.0 Release

We highly recommend all developers using Cmdr to update to this version to benefit from the bug fixes and improvements while addressing the security vulnerability.

If you have any questions, concerns, or feedback regarding this release or the security advisory, please don’t hesitate to reach out. We appreciate your continued support and collaboration in making Cmdr a robust and secure command-line framework.

Happy coding!

5 Likes

Love it, thanks for the update.

1 Like

can you please help with a bug, my commands not always registering

This honestly seems like one, if not the best open source console command system I’ve seen. I might make something similar to this in the future, but for now this is definitely a system that I’ll be looking into and perhaps implementing into my own open sourced admin system.

2 Likes

I have addressed your thread. For faster support from our team, I suggest joining our Discord server and utilizing the #cmdr channel. This way, you can receive prompt assistance.

I know previously I’ve suggested this, but people told me to put a github issue about it, but I forgot and now I’m blocked from creating issues, so I’ll put it here.

Ability to define a table of command permissions/groups like:

return {
	Name = "kick",
	Aliases = {"boot"},
	Description = "Kicks a player",
	Group = {"Creators", "Administrators"},
	Args = {
		{
			Type = "player",
			Name = "target",
			Description = "The player being kicked"
		},
		{
			Type = "string",
			Name = "reason",
			Description = "The reason for kicking this player"
		}
	}
}

This will be useful, if somebody has multiple command permissions and can set them individually. I would pull request a feature like this, but cannot.

The Group property within the CommandDefinition interface serves as a categorization label for commands, functioning much like an identifier. To regulate user access and permissions for specific commands, it is recommended to utilize a BeforeRun hook that evaluates the command’s associated Group.

1 Like

Alright, thank you. Do you know how to get the Group property within the commanddefinition?

return {
	Name = "kick",
	Aliases = {"boot"},
	Description = "Kicks a player",
	Group = {"Creators", "Administrators"}, -- want to get this in my BeforeRun
	Args = {
		{
			Type = "player",
			Name = "target",
			Description = "The player being kicked"
		},
		{
			Type = "string",
			Name = "reason",
			Description = "The reason for kicking this player"
		}
	}
}

Your BeforeRun hook’s callback receives the CommandContext object as a parameter.

It only prints out the first value of my Group CommandDefination, and not both of my command definitions.

it prints:
["Group"] = "Creators",

and not
["Group"] = {"Creators", "Administrators"},

Edit: Code retracted due to the person helping me removed their message;

1 Like

Please provide your code for additional assistance.

1 Like

I found this very useful, But I did (kinda) run into an issue while Making a gravity Command.

It works fine with numbers but I want to it be a
Number or “Default”
I like that It has typechecks, But I want to cram multiple types into one function. Like number|"Default"|"Random"

For now I am just using a ResetGravity function. and CrazyGravity

1 Like

I suggest developing a custom number type tailored to your specific scenario instead of relying on the default number type. You can refer to the Types guide for a detailed example of how to create a custom type that suits your needs.

1 Like

Hello, thank you for taking the time to read my comment.

I do have a question/suggestion and it is regarding future plans for management of team’s;

Is there plans for group permissions and or, management features, such as roles in groups giving specific permissions?

this project seems it would have benefits with more gravitas if it was optimised for group ID’s and rank’s allowing more genuine control over administrative features for multiple users.
Other than this small overlook, I feel this is an extremely powerful resource and I’m intrigued by your project.

From reading, it seems to be an extensive module for intricate customisation via command’s.

I’ll have to look into this further later.

1 Like

It is already possible to establish permissions based on a user’s role in a group using hooks, particularly the BeforeRun hook.

2 Likes

how to make it accesable for mobile players?

1 Like

To toggle the visibility of the console, you can utilize the CmdrClient:Toggle() method. However, you’ll need to develop your own method for detecting user input to determine when to invoke the method.

2 Likes