Edit interaction reply if necessary for error messages

This commit is contained in:
Max Isom 2021-12-12 20:31:55 -05:00
parent dcb1351791
commit d2ab10a13a
No known key found for this signature in database
GPG key ID: 25C9B1A7F6798880
2 changed files with 7 additions and 2 deletions

View file

@ -62,7 +62,12 @@ export default class {
}
} catch (error: unknown) {
debug(error);
await interaction.reply({content: errorMsg(error as Error), ephemeral: true});
if (interaction.replied || interaction.deferred) {
await interaction.editReply(errorMsg('something went wrong'));
} else {
await interaction.reply({content: errorMsg(error as Error), ephemeral: true});
}
}
});

View file

@ -15,7 +15,7 @@ import GetSongs from '../services/get-songs.js';
export default class implements Command {
public readonly slashCommand = new SlashCommandBuilder()
.setName('play')
.setDescription('Play a song')
.setDescription('Play a song or resume playback')
.addStringOption(option => option
.setName('query')
.setDescription('YouTube URL, Spotify URL, or search query'))