Unreal supports multiple ways to add custom commands for the Console. Below are two of the most convenient.

UFUNCTION(Exec)

If you have a class such as the CheatManager, you can simply add new UFUNCTIONs into it, and give it the Exec specifier. This allows you to run the command from the console.

UFUNCTION(Exec)
void MyCommand();

This allows you to run MyCommand from the console.

Various parameter types are also supported:

UFUNCTION(Exec)
void MyCommand(FString Param);

Using MyCommand somestring would execute this function with somestring as its parameter.

FAutoConsoleCommand

You can also create console commands using FAutoConsoleCommand. This is convenient for usecases such as Editor Modules, where you might not have a cheat manager or such available.

Simply place the following into a .cpp file:

static FAutoConsoleCommand ConsoleCommandName(
	TEXT("ActualCommandText"),
	TEXT("Description of the command"),
	FConsoleCommandDelegate::CreateLambda([]()
	{
		/* do something */
	})
);

Note that the name of the console command variable ConsoleCommandName can differ from the actual command. In the above example, the command is triggered using ActualCommandText.

There are some other delegate types available for several different purposes. You can find them in IConsoleManager.h.