Message.edit() does not let you use None to clear a message's content #22

Closed
opened 2026-02-15 23:16:16 -05:00 by yindo · 2 comments
Owner

Originally created by @MysticMia on GitHub (Jun 19, 2023).

Describe the bug
Unlike member.edit() where you can reset someone's username by passing None, you can't clear a message's content by editing it using None.

To Reproduce

await message.edit(content=None, embeds=embed)

Expected behavior
Expected message content to clear. This did not happen, however.

Library version
0.1.11

Additional context
This is likely caused by the following code:

def edit_message(self, channel: str, message: str, content: Optional[str], embeds: Optional[list[SendableEmbedPayload]] = None) -> Request[None]:
    json = {}

    if content is not None:
        json["content"] = content

Instead of setting the default to and checking for revolt.utils.Missing, it sets/checks it None. This means you can't un-set something by passing the None argument because it'll be filtered out as 'default' argument.

Originally created by @MysticMia on GitHub (Jun 19, 2023). **Describe the bug** Unlike member.edit() where you can reset someone's username by passing None, you can't clear a message's content by editing it using None. **To Reproduce** ```py await message.edit(content=None, embeds=embed) ``` **Expected behavior** Expected message content to clear. This did not happen, however. **Library version** 0.1.11 **Additional context** This is likely caused by the following code: ```py def edit_message(self, channel: str, message: str, content: Optional[str], embeds: Optional[list[SendableEmbedPayload]] = None) -> Request[None]: json = {} if content is not None: json["content"] = content ``` Instead of setting the default to and checking for revolt.utils.Missing, it sets/checks it None. This means you can't un-set something by passing the None argument because it'll be filtered out as 'default' argument.
yindo added the unconfirmed bug label 2026-02-15 23:16:16 -05:00
yindo closed this issue 2026-02-15 23:16:16 -05:00
Author
Owner

@MysticMia commented on GitHub (Jun 19, 2023):

It works if you pass "" (an empty string) for the message content, instead of None.

@MysticMia commented on GitHub (Jun 19, 2023): It works if you pass `""` (an empty string) for the message content, instead of None.
Author
Owner

@Zomatree commented on GitHub (Jun 20, 2023):

You cant pass None to clear the content, the Revolt API does not support that.

@Zomatree commented on GitHub (Jun 20, 2023): You cant pass `None` to clear the content, the Revolt API does not support that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: stoatchat/python-client-sdk#22