Messages
guideSending, building and managing Discord messages, from a plain post to files, reactions and polls.
This section covers everything a bot does with messages: sending them, building them ahead of time, attaching embeds and files, editing and pinning, reacting, and creating and reading polls. You already have a bot named "my-bot" logged in (see Starting a bot) and have read the concepts section, in particular cache and await and builders.
Three ways to send
post fires text, an embed or a component at any channel and forgets it. reply with answers the current message or interaction the same way, without you naming a channel. The message builder configures everything first, and the build result of it is the only one that hands you back the sent message to edit, pin or reference later.
Need | Use |
|---|---|
Send to a channel you already have, and move on |
|
Answer the message or interaction the current event is about |
|
Attach files, add components, or keep the sent message afterward | the message builder |
Reply with something built ahead of time, still without keeping it |
|
Reading order
- Sending messages:
post,reply with, the message builder and its options. - Embeds: every embed property and its fields.
- File uploads: attaching files and reading them back.
- Managing messages: edit, pin, publish, forward, purge, typing.
- Reactions: reacting, suppressing reactions, reaction events.
- Creating polls: building a poll and sending it alone or on a message.
- Polls: reading a poll, listing its voters, ending it, vote events.
To post under another name and avatar, see the webhooks section.