#Application did not respond

1 messages · Page 1 of 1 (latest)

vague arch
#

I've checked documentation as well as on this discord to find a fix but I don't seem to be finding any?

I tried what was also said in general about sync'ing your PC date and time and that also didn't work.

Essentially the code works correctly, no issues there but despite every part of it working it for some reason throws an "Application did not respond".

The command is a purge command

public class Purge: InteractionModuleBase<SocketInteractionContext>
{

    [SlashCommand("purge", "Purges a certain amount of messages")]
    [RequireUserPermission(GuildPermission.ManageMessages)]

    // Purge a certain amount of messages
    public async Task PurgeMessages(int amount)
    {
        EmbedBuilder embed = new();
        embed.WithTitle("Purge Command");
        embed.WithColor(0x0502828);
        embed.WithCurrentTimestamp();
        embed.WithFooter(x => x.Text = "Eclipse - Purge Command");

        if (amount <= 0)
        {
            embed.WithDescription("You did not provide a valid amount of messages to purge.");
            await RespondAsync(embeds: new[] { embed.Build() }, ephemeral: true);
            return;
        }

        else if(amount > 100)
        {
            embed.WithDescription("You cannot purge more than 100 messages at once.");
            await RespondAsync(embeds: new[] { embed.Build() }, ephemeral: true);
        }
        try
        {
            var messages = await Context.Channel.GetMessagesAsync(amount).FlattenAsync();
            await (Context.Channel as SocketTextChannel).DeleteMessagesAsync(messages);

            embed.WithDescription("Purged " + amount + " messages.");
            var _Message = await ReplyAsync(embeds: new[] { embed.Build() });

            await Task.Delay(2000);
            await _Message.DeleteAsync();
        }
        catch (Exception ex)
        {
            embed.WithDescription("An error occurred while purging messages: " + ex.Message);
            await RespondAsync(embeds: new[] { embed.Build() }, ephemeral: true);
        }
    }
}

I don't have any usings here because I already declared them as globals

balmy coral
vague arch
#

the issue of when I use RespondAsync() is that I get this

#

And if I simply do

await RespondAsync(embeds: new[] { embed.Build() });

I can't delete it after or at least I'm not sure how

balmy coral
#

Btw there's an embed parameter that takes a single embed instead of a new array

vague arch
#

oh that works

vague arch
#

I was just using what a friend referenced me 💀