Tutorial: Announce Bot
In this tutorial, you'll build a Bot that listens for a specific command in a Root community and responds by broadcasting the message to all text channels.
Root concepts covered
- Listening for events: Hook into
ChannelMessageCreatedEventto react when users send messages. - Command parsing: Check message content to identify
/announcecommands. - User mentions: Retrieve the sender’s nickname and format a Root-style user mention.
- Channel discovery: Enumerate all community channel groups and text channels.
- Message sending: Send a custom message to every text channel in the community.
- Error handling: Gracefully handle and log both expected and unexpected exceptions using
RootApiException.
Prerequisites
- High-beginner to low-intermediate level TypeScript knowledge including asynchronous coding.
Solution code
A fully implemented version of this project is available in the Root samples repository.