Update bunny command to defer reply until it finds an image
This commit is contained in:
parent
790afcca4a
commit
f3d67bb33a
1 changed files with 5 additions and 3 deletions
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue