Skip to content

Commit

Permalink
chore: stop sending discord error to sentry (#156)
Browse files Browse the repository at this point in the history
* chore: stop sending discord error to sentry

* chore: ignore all discord runtime error
  • Loading branch information
wa0x6e committed Jan 12, 2024
1 parent a9961b1 commit 74f3c24
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/providers/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
EmbedBuilder,
codeBlock,
underscore,
inlineCode
inlineCode,
DiscordAPIError
} from 'discord.js';
import db from '../helpers/mysql';
import removeMd from 'remove-markdown';
Expand Down Expand Up @@ -146,8 +147,10 @@ const checkPermissions = async (channelId, botId) => {
return `I do not have permission to send messages in this channel ${discordChannel.toString()}, Add permission and try again`;
return true;
} catch (error) {
capture(error);
console.log('[discord] error checking permissions', error);
if (!(error instanceof DiscordAPIError)) {
capture(error);
}
console.error('[discord] error checking permissions', error);
const channelExistWithName = client.channels.cache.find(
c => c.name === channelId
);
Expand Down Expand Up @@ -320,8 +323,11 @@ export const sendMessage = async (channel, message) => {
await speaker.send(message);
success = true;
return true;
} catch (e) {
capture(e);
} catch (error) {
if (!(error instanceof DiscordAPIError)) {
capture(error);
}
console.error('[discord] Failed to send message', channel, error);
} finally {
end({ status: success ? 200 : 500 });
}
Expand Down

0 comments on commit 74f3c24

Please sign in to comment.