#Delete ephemeral messages

1 messages · Page 1 of 1 (latest)

karmic ether
#

Hi, yes I am the one posting a help thread.
I don't remember if that's something possible, but can you force to delete an ephemeral message using components that were sent in that ephemeral message?

devout cragBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

karmic ether
#

await ctx.delete(msg), where msg is the ephemeral message gives me back a 404 error

storm vine
#

Yes you can, but not in v5 xD

karmic ether
#

that's what I thought, I looked through the help threads but this question was only answered for v4

#

why is it not implemented?

storm vine
#

can you try message.delete(context=ctx)

#

But I think it wont work

karmic ether
#

nope same thing

storm vine
#

Then yes, it's just not implemented

karmic ether
#

bruh

karmic ether
#

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

stiff hazel
#

i would do await ctx.delete(message) in v5 usually

karmic ether
#

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

stiff hazel
#

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

karmic ether
#

the weird thing being that, normally the context you would have is the second one

fast haven
#

will this be propertly implemented any time soon?

stiff hazel
#

ive been chasing bugs left and right - this one slipped me by 😅

#

i'll pr it after 5.8.0

fast haven
#

nice

stoic wave
brisk dagger
karmic ether
#

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

brisk dagger
#

ohh wait this is old...

#

was at top and I thought it was a new post... oops

stiff hazel
#

"fixed" in #1481

devout cragBOT
# stiff hazel "fixed" in #1481

• Pull Request Type: Feature addition
• Created: <t:1689277688:R>

Description

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.

Changes
  • Add @original as the default message for InteractionContext.edit/delete, and pass them directly in if the message is that. Discord handles the rest.
Related Issues

N/A

Test Scenarios

N/A

Python Compatibility
  • ❌ I've ensured my code works on Python 3.10.x
  • ✅ I've ensured my code works on Python 3.11.x
Checklist
  • ✅ I've run the pre-commit code 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
stiff hazel
#

(its not really a fix because it turns out this wasnt a bug at all - just makes deleting/editing a lot better)

strange tiger
# stiff hazel "fixed" in #1481

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)

stiff hazel
#

its more like component_ctx.delete()

#

but yes

strange tiger
#

thanks :)

stiff hazel
#

you can do ctx.delete(ctx.message) rn though i think

strange tiger
#

monkaHmm ill try thx

stiff hazel
#

(i mean component_ctx btw, im just lazy)

strange tiger
#

yeye

#

saved a lot of time there :>