Skip to content

Commit

Permalink
feat: specific message for permission errors
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Feb 15, 2025
1 parent 8f46e5b commit f622cfe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/i18n/en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,14 @@ misc:
not_ticket:
description: You can only use this command in tickets.
title: ❌ This isn't a ticket channel
permissions_error:
description: Sorry, the operation failed due to insufficient permissions.
fields:
for_admins:
name: For server administrators
value: >
[Click here]({url}) for resolution instructions.
title: ⚠️ Something went wrong
ratelimited:
description: Try again in a few seconds.
title: 🐢 Please slow down
Expand Down
13 changes: 13 additions & 0 deletions src/lib/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ module.exports.handleInteractionError = async event => {
},
]),
);
} else if (/Missing Permissions/.test(error.message)) {
data.embeds.push(
new EmbedBuilder()
.setColor('Orange')
.setTitle(getMessage('misc.permissions_error.title'))
.setDescription(getMessage('misc.permissions_error.description'))
.addFields([
{
name: getMessage('misc.permissions_error.fields.for_admins.name'),
value: getMessage('misc.permissions_error.fields.for_admins.value', { url: 'https://discordtickets.app/self-hosting/troubleshooting/#missing-permissions' }),
},
]),
);
} else {
data.embeds.push(
new EmbedBuilder()
Expand Down

0 comments on commit f622cfe

Please sign in to comment.