-
Greetings everyone :) I've asked this in your Discord-Server already, but either the answer to the question is way to easy and they do not event want to answer it, or the people who read it did not know the answer either.... This is where I get to my actual question: Discords API Documentation says, that it is possible to delete an ephemeral message, but you would have to use another endpoint which requires the interaction token in order to delete the message. This is my code so far: [ComponentInteraction("create_ticket_whitelist")]
public async Task CreateWhitelistTicket()
{
await DeferAsync(ephemeral: true);
// doing some work here
await FollowupAsync(embed: GetEmbed("CREATEWLTICKET"), ephemeral: true);
_ = Task.Delay(5 * 1000) // wait for 5 seconds
.ContinueWith(async _ => await Context.Interaction.DeleteOriginalResponseAsync()) // delete the ephemeral message
.ConfigureAwait(false);
} This piece of code though deletes the dashboard message instead of the ephemeral response. I could provably use the information provided by the Library and call the endpoint myself, but I guess that would destroy the whole purpose of using the library at all... Thank you guys for reading Kindly, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Well just a small example var msg = await FollowupAsync(...) as RestFollowupMessage;
_ = Task.Delay(TimeSpan.FromSeconds(5)).ContinueWith(_ =>msg.DeleteAsync())); |
Beta Was this translation helpful? Give feedback.
Well
Using the
IUserMessage
returned byFollowupAsync()
is actually the right way here.You just need to cast it to
RestFollowupMessage
& callDeleteAsync()
on it. It will make a call toDelete Followup Message
endpoint and delete the msg.just a small example