- properly handle permissions for user commands

- add central permission group constant
This commit is contained in:
bignutty 2024-12-08 14:49:57 +01:00
parent dcb823a0a1
commit d2aeecf70d
100 changed files with 245 additions and 942 deletions

View file

@ -3,8 +3,8 @@ const { createEmbed } = require("#utils/embed");
const { editOrReply } = require("#utils/message");
const { icon } = require("#utils/markdown");
// TODO: Turn this into a general purpose permissions constant
const { Permissions } = require("detritus-client/lib/constants");
const { PERMISSION_GROUPS } = require("#constants");
// TODO: rework this eventually
// -> filter by user
@ -22,7 +22,7 @@ module.exports = {
{default: 20, name: 'amount', type: 'integer', help: "Amount of messages to be checked (1-20)"},
{default: true, name: 'case', type: 'bool', help: "If provided, should the search query be case sensitive"},
],
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.MANAGE_MESSAGES, Permissions.READ_MESSAGE_HISTORY],
permissionsClient: [...PERMISSION_GROUPS.baseline, Permissions.MANAGE_MESSAGES],
permissions: [Permissions.MANAGE_MESSAGES],
onPermissionsFail: (context) => editOrReply(context, {content: `${icon("failiure_simple")} ${context.message.author.mention}, you are lacking the permission \`Manage Messages\`.`}),
ratelimit: {