Modding:Chat Commands
Appearance
← Index
This page documents how custom chat commands are handled by the game. This is an advanced guide for mod developers.
Copied from Modding:Migrate to Stardew Valley 1.6.9
Chat commands are now modular and extensible in 1.6.9, with a new ChatCommands API to manage them.
For example, you can add a custom chat command like this:
string modId = this.ModManifest.UniqueId;
ChatCommands.Register($"{modId}_echo", this.Echo, name => $"{name} [message]: show the given message in the chat box.");
...
/// <inheritdoc cref="ChatCommandHandlerDelegate" />
private void Echo(string[] command, ChatBox chat)
{
string message = ArgUtility.GetRemainder(command, 1);
chat.addInfoMessage(message);
}