From f3d67bb33a86c81f81aa4d52cb0d3836ee8f544a Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 19 Apr 2024 18:16:25 +0100 Subject: [PATCH] Update bunny command to defer reply until it finds an image --- src/commands/bunny.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/commands/bunny.ts b/src/commands/bunny.ts index b735f61..3285083 100644 --- a/src/commands/bunny.ts +++ b/src/commands/bunny.ts @@ -7,7 +7,7 @@ export default class Bunny extends Command { constructor() { super(); - super.CommandBuilder = new SlashCommandBuilder() + this.CommandBuilder = new SlashCommandBuilder() .setName("bunny") .setDescription("Get a random picture of a rabbit."); } @@ -15,6 +15,8 @@ export default class Bunny extends Command { public override async execute(interaction: CommandInteraction) { if (!interaction.isChatInputCommand()) return; + await interaction.deferReply(); + const subreddits = [ 'rabbits', 'bunnieswithhats', @@ -37,9 +39,9 @@ export default class Bunny extends Command { .setURL(`https://reddit.com${result.Result!.Permalink}`) .setFooter({ text: `r/${selectedSubreddit} ยท ${result.Result!.Ups} upvotes`}); - await interaction.reply({ embeds: [ embed ]}); + await interaction.editReply({ embeds: [ embed ]}); } else { - await interaction.reply("There was an error running this command."); + await interaction.editReply("There was an error running this command."); } } } \ No newline at end of file