Modding:Chat Commands: Difference between revisions
Appearance
imported>BarleyZP create page with info from Modding:Migrate to Stardew Valley 1.6.9 (main author Pathoschild) |
imported>Sunbeam135 |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 3: | Line 3: | ||
This page documents how custom [[Multiplayer#Chat|chat commands]] are handled by the game. This is an advanced guide for mod developers. | This page documents how custom [[Multiplayer#Chat|chat commands]] are handled by the game. This is an advanced guide for mod developers. | ||
== | ==Registering custom commands== | ||
Chat commands are | Chat commands are modular and extensible, with a <samp>ChatCommands</samp> API to manage them. | ||
For example, you can add a custom chat command like this: | For example, you can add a custom chat command like this: | ||
| Line 22: | Line 22: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | |||
* [[Modding:Console commands]] for commands that can be typed in the SMAPI console. | |||
[[Category:Modding]] | [[Category:Modding]] | ||
[[ru:Модификации:Чат-команды]] | |||
[[zh:模组:聊天命令]] | |||
Latest revision as of 10:46, 3 January 2026
← 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
- Modding:Console commands for commands that can be typed in the SMAPI console.