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,8 +62,13 @@ export default class {
} }
} catch (error: unknown) { } catch (error: unknown) {
debug(error); debug(error);
if (interaction.replied || interaction.deferred) {
await interaction.editReply(errorMsg('something went wrong'));
} else {
await interaction.reply({content: errorMsg(error as Error), ephemeral: true}); await interaction.reply({content: errorMsg(error as Error), ephemeral: true});
} }
}
}); });
this.client.once('ready', async () => { this.client.once('ready', async () => {

View file

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