#Delete ephemeral messages
1 messages · Page 1 of 1 (latest)
Hey! Once your issue is solved, press the button below to close this thread!
await ctx.delete(msg), where msg is the ephemeral message gives me back a 404 error
Yes you can, but not in v5 xD

that's what I thought, I looked through the help threads but this question was only answered for v4
why is it not implemented?
nope same thing
Then yes, it's just not implemented
bruh
await self.bot.http.delete_interaction_message(self.bot.app.id, ctx.token)
Ok so I was able to do it this way, by looking at v4 source code
I find it kinda weird because in this case, ctx is not the context from the button pressed but actually from the context that created the button (for me a slash command)
but whatever it works. I'm not implementing it in v5 because Idk how it would be done exactly
i would do await ctx.delete(message) in v5 usually
yeah but the issue is that you need the base ctx, not the one when pressing the button
so I did it using wait_for_component
huh... it should literally be doing the http request from v4
i see, the @original part must be the reason
weird that it doesnt work with an id, but i guess fair enough
This code using the context that already got an answer (the ephemeral message): WORKS
This code using the button pressed context: 404 ERROR
the weird thing being that, normally the context you would have is the second one
will this be propertly implemented any time soon?
ive been chasing bugs left and right - this one slipped me by 😅
i'll pr it after 5.8.0
nice
For me, the button context works
this works for me:
msg = await ctx.send('Success!', ephemeral=True)
await ctx.delete(msg.id)
look Idk
you guys have ressuscitated a post where I had a hacky way to solve it xD
but if it works for you cool
"fixed" in #1481
• Pull Request Type: Feature addition
• Created: <t:1689277688:R>
This PR adds a default value for the message in InteractionContext.edit/delete that deletes the initial interaction response. Many people were getting confused at those two not doing exactly this, resulting in things that seemed like bugs to them.
- Add
@originalas the defaultmessageforInteractionContext.edit/delete, and pass them directly in if the message is that. Discord handles the rest.
N/A
N/A
- ❌ I've ensured my code works on Python
3.10.x - ✅ I've ensured my code works on Python
3.11.x
- ✅ I've run the
pre-commitcode linter over all edited files - ✅ I've tested my changes on supported Python versions
- ❌ I've added tests for my code, if applicable
- ❌ I've updated / added documentation, where applicable
(its not really a fix because it turns out this wasnt a bug at all - just makes deleting/editing a lot better)
i was keeping track of this thread because i was waiting to do something like component_ctx.message.delete(), is that this? 😅
(for ephemeral messages where im getting 404s)
thanks :)
you can do ctx.delete(ctx.message) rn though i think
ill try thx
(i mean component_ctx btw, im just lazy)