© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
24 replies
REAPER

Slash Command purge [Answered]

Hi, I'm trying to use my old purge command as a slash command, but I end up giving me the Discord Error "Application Didn't Respond".

I've tried making the var message a RespondAsync but the code is not happy about that rooCry

Does anyone know how to solve this issue of mine?

            var messages = await Context.Interaction.Channel.GetMessagesAsync(amount).FlattenAsync();
            await (Context.Interaction.Channel as SocketTextChannel).DeleteMessagesAsync(messages);

            var message = await Context.Interaction.Channel.SendMessageAsync($"{messages.Count()} messages deleted successfully!");
            await Task.Delay(4000);
            await message.DeleteAsync();
            var messages = await Context.Interaction.Channel.GetMessagesAsync(amount).FlattenAsync();
            await (Context.Interaction.Channel as SocketTextChannel).DeleteMessagesAsync(messages);

            var message = await Context.Interaction.Channel.SendMessageAsync($"{messages.Count()} messages deleted successfully!");
            await Task.Delay(4000);
            await message.DeleteAsync();
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Slash command choices [Answered]
C#CC# / help
4y ago
Slash Command optional parameter [Answered]
C#CC# / help
4y ago
Slash Command works but gives error? [Answered]
C#CC# / help
4y ago
✅ Slash Command response to specific channel
C#CC# / help
4y ago