DOCUMENTATION / COMMANDS
A useful action, one command away.
Typed command definitions and validated interactions make your bot discoverable inside a community channel.
Define commands
Options support string, integer, number, boolean, user, role and channel values. Choices and numeric bounds are checked again on the server. defaultMemberPermissions uses the community’s existing 0–127 permission mask, not the bot permission flags.
Setting commands replaces the application’s current command definitions. Only members who satisfy the command’s permission requirement can see or run it. Entity options are scoped to the current community.
import { SlashCommandBuilder } from '@relaychat/sdk';
await bot.commands.set([new SlashCommandBuilder()
.setName('help').setDescription('Ask the support team')
.addStringOption(o => o.setName('topic')
.setDescription('What do you need?').setRequired(true))]);Respond to interactions
reply() is private by default. Pass { content: "...", ephemeral: false } for a public channel reply. deferReply() gives you time to work; editReply() updates the private response. followUp() adds a private follow-up. Respond before the 15-minute interaction expiry. An interaction may open one modal; submission creates a new interaction bound to the same member.
Interactive controls belong in public messages. Private responses support text, embeds and attachments. Private responses are delivered only to the member who invoked the interaction, while they retain access to the channel. They are server-readable community features.
bot.on('interactionCreate', async interaction => {
if (interaction.commandName !== 'help') return;
await interaction.deferReply();
// Do the work, then replace the private deferred response.
await interaction.editReply({ content: 'Your request is ready.' });
});
relay