Skip to content

message_edit

message_edit changes an existing message. Authors use it to fix their own messages, and moderators can use it on anyone’s.

{
"cmd": "message_edit",
"channel": "general",
"id": "7d0e4c1a-5b8f-4b0e-8f55-2d3c9a61e7b4",
"content": "Release notes are up (updated link): https://example.com/changelog/2"
}
Field Type Required Description
channel string One of channel or thread_id Channel name.
thread_id string One of channel or thread_id Thread ID. If you also send channel, it must be the thread’s parent.
id string Yes ID of the message to edit.
content string See below New text. Replaces the old text.
embeds array See below New embeds. Replaces the whole embed list. Same rules as message_new.
attachments array See below New attachments. Replaces the whole attachment list. Send [] to remove them all.
alias object No New alias, with the same rules as message_new. An empty object removes the alias.
author_id string No Signing field. Your own user ID.
key_id string No Signing field. Your Rotur signing key ID.
signature string No Signing field. Signature of the edited message.
timestamp number No Signing field. When you signed, in Unix seconds. Within 5 minutes of the server clock, and later than the previous signature.

Send at least one of content, embeds, or attachments. Fields you leave out stay as they are. The edited message must still have text, an embed, or an attachment.

Polls can’t be added, removed, or changed by an edit. If the message has a poll, keep its poll embed exactly as it is in embeds.

A Rotur account can sign an edit the same way it signs a new message. See signing.

  • If you wrote a signed message, an edit that changes content or attachments must also be signed.
  • Only the original author can sign an edit. A signed edit also sets edited_at.
  • When a moderator changes the content or attachments of someone else’s message, the server removes the signature and sets edited_by to the moderator’s user ID.
  • Server-local accounts can’t sign; the server ignores signing fields for them.

The server sends this event to you and to every other connection that can view the channel:

{
"cmd": "message_edit",
"channel": "general",
"id": "7d0e4c1a-5b8f-4b0e-8f55-2d3c9a61e7b4",
"message": {
"id": "7d0e4c1a-5b8f-4b0e-8f55-2d3c9a61e7b4",
"user": "alice",
"author_id": "<alice's user ID>",
"timestamp": 1788940000.31,
"content": "Release notes are up (updated link): https://example.com/changelog/2",
"edited": true
}
}
  • message is the complete updated message object. Replace your stored copy with it.
  • A thread edit has thread_id on the frame, and channel is the thread’s parent.
  • Only your copy carries your request’s listener. Users severed from you don’t receive the event.
  • If link previews are on, the server may send a second message_edit later with updated preview embeds. See link previews.

You must be able to view the channel. Then:

  • For your own message, your roles need edit_own in the channel.
  • For someone else’s message, your roles need edit.

Editing works in locked threads if you have these permissions. A user in a timeout can’t edit.

val When
Channel not found The channel doesn’t exist, or you sent neither channel nor thread_id.
Thread not found No thread has this ID.
Thread does not belong to this channel channel is not the thread’s parent.
You do not have permission to view this thread You can’t view the thread’s parent channel.
Messages must be sent inside a thread in forum channels channel is a forum and you sent no thread_id.
This channel does not support chat channel is a separator.
Access denied to this channel You can’t view the channel.
Message not found No message with this ID is in the channel or thread.
You do not have permission to edit your own messages in this channel Your roles lack edit_own.
You do not have permission to edit messages in this channel The message is someone else’s and your roles lack edit.
Polls cannot be added through message_edit The new embeds have a poll and the message had none.
Polls cannot be removed through message_edit The message had a poll and the new embeds don’t.
Polls cannot be changed through message_edit The poll embed differs from the stored one.
A signed message requires a signed edit You changed the text or attachments of your own signed message without signing.
Only the original author can sign a message edit You signed an edit to someone else’s message, or author_id is not your ID.
Message edit signature is invalid key_id doesn’t start with rotur_sk_, or signature is not 80 to 100 characters.
Message edit signed timestamp is outside the allowed window timestamp is more than 5 minutes from the server clock.
Message edit signed timestamp must be newer than the previous signature timestamp is not later than the message’s current signature.
You do not have permission to mention the '@&<role>' role The new text mentions a role you can’t mention.
Attachment <id> not found or expired An attachment has expired or its file is gone.
Message blocked by automod Automod matched the edit. You may also be put in a timeout.
Message must have content, attachments, or embeds The edit would leave the message empty.

Invalid embeds, attachments, or alias return the same messages as message_new. A request with none of content, embeds, or attachments returns a validation message. A user in a timeout gets a rate_limit frame; see the protocol model.