hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
76 lines (36 loc) • 1.11 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [ChatManager](./server.chatmanager.md) > [registerCommand](./server.chatmanager.registercommand.md)
## ChatManager.registerCommand() method
Register a command and its callback.
**Signature:**
```typescript
registerCommand(command: string, callback: CommandCallback): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
command
</td><td>
string
</td><td>
The command to register.
</td></tr>
<tr><td>
callback
</td><td>
[CommandCallback](./server.commandcallback.md)
</td><td>
The callback function to execute when the command is used.
\*\*Requires:\*\* Use a consistent command prefix (for example, `/kick`<!-- -->) if you want slash commands.
</td></tr>
</tbody></table>
**Returns:**
void
## Remarks
Commands are matched by exact string equality against the first token in a chat message.