Skip to content

Commit

Permalink
fix: Fix incorrect exception handling when querying songs
Browse files Browse the repository at this point in the history
  • Loading branch information
hmes98318 committed Nov 30, 2024
1 parent 8b59539 commit 20e07d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/commands/play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const execute = async (bot: Bot, client: Client, message: Message, args:
const res = await client.lavashark.search(str);

if (res.loadType === LoadType.ERROR) {
bot.logger.emit('error', bot.shardId, `Search Error: ${res.exception?.message}`);
return message.reply({ content: `❌ | No results found.`, allowedMentions: { repliedUser: false } });
bot.logger.emit('error', bot.shardId, `Search Error: ${(res as any).data?.message}`);
return message.reply({ content: `❌ | No results found. (${(res as any).data?.message})`, allowedMentions: { repliedUser: false } });
}
else if (res.loadType === LoadType.EMPTY) {
return message.reply({ content: `❌ | No matches.`, allowedMentions: { repliedUser: false } });
Expand Down Expand Up @@ -111,8 +111,8 @@ export const slashExecute = async (bot: Bot, client: Client, interaction: ChatIn
const res = await client.lavashark.search(str!);

if (res.loadType === LoadType.ERROR) {
bot.logger.emit('error', bot.shardId, `Search Error: ${res.exception?.message}`);
return interaction.editReply({ content: `❌ | No results found.`, allowedMentions: { repliedUser: false } });
bot.logger.emit('error', bot.shardId, `Search Error: ${(res as any).data?.message}`);
return interaction.editReply({ content: `❌ | No results found. (${(res as any).data?.message})`, allowedMentions: { repliedUser: false } });
}
else if (res.loadType === LoadType.EMPTY) {
return interaction.editReply({ content: `❌ | No matches.`, allowedMentions: { repliedUser: false } });
Expand Down
8 changes: 4 additions & 4 deletions src/commands/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const execute = async (bot: Bot, client: Client, message: Message, args:
const res = await client.lavashark.search(str);

if (res.loadType === LoadType.ERROR) {
bot.logger.emit('error', bot.shardId, `Search Error: ${res.exception?.message}`);
return message.reply({ content: `❌ | No results found.`, allowedMentions: { repliedUser: false } });
bot.logger.emit('error', bot.shardId, `Search Error: ${(res as any).data?.message}`);
return message.reply({ content: `❌ | No results found. (${(res as any).data?.message})`, allowedMentions: { repliedUser: false } });
}
else if (res.loadType === LoadType.EMPTY) {
return message.reply({ content: `❌ | No matches.`, allowedMentions: { repliedUser: false } });
Expand Down Expand Up @@ -182,8 +182,8 @@ export const slashExecute = async (bot: Bot, client: Client, interaction: ChatIn
const res = await client.lavashark.search(str!);

if (res.loadType === LoadType.ERROR) {
bot.logger.emit('error', bot.shardId, `Search Error: ${res.exception?.message}`);
return interaction.editReply({ content: `❌ | No results found.`, allowedMentions: { repliedUser: false } });
bot.logger.emit('error', bot.shardId, `Search Error: ${(res as any).data?.message}`);
return interaction.editReply({ content: `❌ | No results found. (${(res as any).data?.message})`, allowedMentions: { repliedUser: false } });
}
else if (res.loadType === LoadType.EMPTY) {
return interaction.editReply({ content: `❌ | No matches.`, allowedMentions: { repliedUser: false } });
Expand Down

0 comments on commit 20e07d7

Please sign in to comment.