#how do i delete an ephemeral interaction?
1 messages · Page 1 of 1 (latest)
you dont
only the user can get rid of that message
all you can do is update the message to an empty message, or to say "Done" or something like that
#discord-announcements message
depends if it is the original response or a followup, but generally there should be a Get<Original/Followup>MessageAsync method on your interaction object
omg is that live
well if it is its obviously not working lol
or the user already dismissed it?
i struggle to wrap my head around what that means
maybe i've been coding for too long
i need to use whatever interaction that contained the panel interaction?
to delete it?
like the slash command?
i means that you can only delete the ephemeral message through the interaction that made it
so, in my case, a slash command
yeah guess so
but i'm listening to the ComponentInteractionCreatedEvent
so it's quite a long reach
[2023-02-05 19:38:53 +02:00] [108 /WebSocketRec] [Error] Socket handler suppressed an exception
System.NullReferenceException: Object reference not set to an instance of an object.
at DSharpPlus.DiscordClient.OnReadyEventAsync(ReadyPayload ready, JArray rawGuilds, JArray rawDmChannels)
at DSharpPlus.DiscordClient.HandleDispatchAsync(GatewayPayload payload)
at DSharpPlus.DiscordClient.HandleSocketMessageAsync(String data)
at DSharpPlus.DiscordClient.<InternalConnectAsync>g__SocketOnMessage|484_1(IWebSocketClient sender, SocketMessageEventArgs e)
what does mean lol
apparently newer versions of dsharpplus are bad
What version are you using?
i fixed it by going back to stable 4.3.0
i used 4.4.0-nightly-01260 and 4.4.0-nightly-01259
gave up after trying those two and reverted to stable
idk what i had originally
can check if super important (git)
more importantly, how do i modify the contents of the interaction 😭 i keep getting 404
Use nightly 1258
await e.Message.ModifyAsync("Test");
e.Interaction.EditOriginalResponseAsync(new DiscordWebhookBuilder().WithContent("Test"));
none of these worked
ok done
if its a slash command it should be along the lines of
interactionContext.DeleteResponseAsync()
i'm on the event
ComponentInteractionCreatedEvent
not on the slash command
this is after getting what the user selected
so you have a slash command that creates an ephemeral message with a button or a dropdown?
yeah then you cant delete or modify the message from the componentinteractioncreated event
you could use interactivity to wait for the components event in the slash command method
this is waiting for the user though
user can take 2 sec or a minute
is there a safe way to wait for that?
how long will the interaction even be alive for?
as long as you already responded you can take i think up to 5 mins until the interaction goes invalid
i see
and interactivity has a timeout you can set, so you can give the user say 2 mins to do what they want, and if they dont thelly have to rerun the command
i see
can i not make it a 1 time use?
for that interaction in particular
i don't want them to spam mentions easily
you can make it 2 seconds if you like
yep
you can make it any timespan so...
i think default might be 2 mins or so
you can change the app wide default in your interactivity configuration, and then you can also specify a per use timeout separately
for that you just pass a timespan iirc
or you can even pass a CancellationToken
yeah that seems like an awful lot of work for a first project 😅
i'll keep that in mind for my third refactor
already planning third refactor when doing one rn? xD
You do
This usually happens because you haven't actually responded yet
Acknowledge the interaction with a response (such as DeferredMessageUpdate) and then delete the original response.
this works but causes a weird thing
in the MessageDeletedEvent, the Guild is set to null
is that normal?
Possibly?