Messages
These examples use a connectedclient and a string channelId.
Send, edit, and reply
message.reply() inside a messageCreate handler to attach a reply reference:
allowed_mentions: { parse: [], replied_user: false }, so they
do not ping the original author. Pass your own allowed_mentions in the message
body to change that behaviour. Plain send() does not set this default.
Message objects hold frozen snapshots. edit() returns a new Message; an older
object still contains the original content. The raw payload is available as
message.data.
Attach files
PassBlob values and filenames through the second options argument. Talos builds
the multipart body and attachment IDs:
uploads.upload() accepts 1–10 files, has a five-minute deadline by default, and
does not send a message. Instance limits still apply. Its onProgress callback
reports completed file bytes rather than progress within each transfer.
Read history
Fetch a single message when you know its ID:history() to iterate newest first. It fetches pages as you consume them, with
up to 100 messages per request:
before to a message ID to start further back. Omitting limit walks all
available history. Breaking out of the loop stops further page requests. Use
list() if you need a single page; its query fields follow the API schema, so a
page limit is a string such as { limit: "50" }.
Cancel an operation
Message methods acceptsignal, timeoutMs, and reason in their options.
For example:
Pins and deletion
message.pin(), message.unpin(), and message.delete() operate on that message.
client.messages.pins(channelId) returns { items, hasMore }; each item contains
a message and pinnedAt timestamp.
client.messages.bulkDelete(channelId, ids) requires 1–100 unique IDs. Talos
checks that shape locally; the server decides whether the bot is allowed to delete
those messages.
Message-update events are partial payloads. Use messageUpdate to learn which
message changed, then fetch it if your handler needs complete data. See
gateway events.