How would I send an ephemeral message in discord.py?

Viewed 8338

I tried to do a bit of searching of my own, but I was unable to find anything. So I ask you guys, does anyone here know how to send an ephemeral message in discord.py?

this was what I was doing(I heard somewhere that this works, but it didnt):

await message.edit(content="Review  submission cancelled.", embed=None ,ephemeral=True)

Thanks!

2 Answers

You can only send an ephemeral message as a response to an interaction, eg. as a response to a button click or a slash command using interaction.response.send_message("Text", ephemeral=True)

Docs on interaction response

You sadly can't send an ephemeral message if it's not responding to an interaction, and you also can't answer to the same interaction twice.

I have searched a little bit in the propositions that were made for the SlashContext.send and found this:

await ctx.send(text, hidden = True)

This should normally work because it worked for me. (I precise that it only works for slash commands and button interactions. So your message edit will not work I think)

Welcome :)

Related