Read-only mirror of the Stardew Valley Wiki, made while stardewvalleywiki.com is down. Text snapshot 14 September 2026; images not included. Please edit on the real wiki once it is back.

Modding:Chat Commands

From Stardew Valley Wiki
Jump to navigation Jump to search

← Index

This page documents how custom chat commands are handled by the game. This is an advanced guide for mod developers.

Registering custom commands

Chat commands are modular and extensible, with a 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);
}

See also