Lesson 2 — First interaction
Subscribe to a message event and send a reply from the app process, checking the typed action result.
The examples/minimal-bridge app script already replies pong when someone sends !ping in a channel your bot can see.
Keep terminal A running (npm run bot).
Restart terminal B (npm run app) after saving src/app.js if you changed it.
In Discord, mention or invite the bot to a server and channel where it has Read Messages / Send Messages (and Read Message Content if required for your server tier).
Send !ping in that channel. You should see pong from the bot and log lines in the app terminal.
The important pattern
Always treat actions as typed calls that can fail in normal ways. Branch on result.ok:
const result = await app.actions.sendMessage({
channelId: message.channelId,
content: 'pong',
});
if (!result.ok) {
console.error(result.error.code, result.error.message);
}If `!ping` does nothing
See Lesson 3 — usually intents, permissions, or capability scope.