Post on a channel
Send a message on a channel from a command, within the radio's limits.
/announce Meeting at the clubhouse, 19:00 in a DM posts the text on the #club channel.
export default new CommandBuilder()
.setName('announce')
.setDescription('Post on the club channel')
.addStringArg((arg) => arg.setName('text').setRequired().setRest())
.setHandler(async (ctx) => {
const channel = ctx.client.channels.get('#club');
if (!channel) return ctx.reply('#club is not on the radio');
await channel.send(new MessageBuilder().setTitle('📣 Announcement').addLine(ctx.args.text).setOverflow('split'));
return ctx.reply('Posted');
});What happens
client.channels.get() finds a channel by name or by slot index in the radio's table. The bot answers
if the channel is missing instead of failing.
channel.send() accepts a string or a MessageBuilder. A plain string over the budget throws
MessageTooLongError. The builder with setOverflow('split') sends up to three numbered parts instead.
The message goes through the send queue. Transmissions are two seconds apart and the parts of one message stay together.
A channel accepts at most 10 messages per 5 minutes; beyond that channel.send() rejects with
RateLimitError, nothing is queued. Sending on the Public channel is refused outright with
PublicChannelError — see A well-behaved bot.
Go further
- Sending messages for the budgets, the builder and delivery status.
- Restrict a command so only owners can announce.
- A well-behaved bot for the channel rate limit and Public.
- MessageBuilder in the reference.