From d89baa2e1f7fe305cc295f2727c739bb62e7e880 Mon Sep 17 00:00:00 2001 From: Marco Crespi Date: Tue, 26 Nov 2019 10:08:13 +0100 Subject: [PATCH] fix(premium): Fix permissions for premium command --- i18n/bot/en.json | 6 ++++-- src/framework/commands/premium/premium.ts | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/i18n/bot/en.json b/i18n/bot/en.json index 1c965670..8054a66b 100644 --- a/i18n/bot/en.json +++ b/i18n/bot/en.json @@ -725,7 +725,8 @@ "done": "Premium has been successfully activated for this server.", "noGuild": "You must run this command inside a server.", "noSubscription": "You do not have an active premium subscription.\n\nUse {{{ cmd }}} for more info.", - "title": "Activate premium on this server" + "title": "Activate premium on this server", + "permissions": "You need the `Manage Server` permissions to use this command in this server." }, "check": { "declined": "Your payment for premium has been declined, plesae check your Patreon.", @@ -738,7 +739,8 @@ "done": "Premium has been successfully deactivated for this server.", "noGuild": "You must run this command inside a server.", "noSubscription": "You do not have an active premium subscription.\n\nUse {{{ cmd }}} for more info.", - "title": "Deactivate premium on this server" + "title": "Deactivate premium on this server", + "permissions": "You need the `Manage Server` permissions to use this command in this server." }, "feature": { "embeds": { diff --git a/src/framework/commands/premium/premium.ts b/src/framework/commands/premium/premium.ts index 457ba57f..2ef3703e 100644 --- a/src/framework/commands/premium/premium.ts +++ b/src/framework/commands/premium/premium.ts @@ -25,7 +25,7 @@ export default class extends Command { ], group: CommandGroup.Premium, guildOnly: false, - defaultAdminOnly: true, + defaultAdminOnly: false, extraExamples: ['!premium check', '!premium activate', '!premium deactivate'] }); } @@ -124,6 +124,8 @@ export default class extends Command { embed.description = t('cmd.premium.activate.noGuild'); } else if (isPremium) { embed.description = t('cmd.premium.activate.currentlyActive'); + } else if (!message.member.permission.has(GuildPermission.MANAGE_GUILD)) { + embed.description = t('cmd.premium.activate.permissions'); } else if (!subs) { embed.description = t('cmd.premium.activate.noSubscription', { cmd: '`' + settings.prefix + 'premium`' @@ -150,8 +152,8 @@ export default class extends Command { embed.description = t('cmd.premium.deactivate.customBot'); } else if (!guildId) { embed.description = t('cmd.premium.deactivate.noGuild'); - } else if (!message.member.permission.has(GuildPermission.ADMINISTRATOR)) { - embed.description = t('cmd.premium.deactivate.adminOnly'); + } else if (!message.member.permission.has(GuildPermission.MANAGE_GUILD)) { + embed.description = t('cmd.premium.deactivate.permissions'); } else if (!isPremium) { embed.description = t('cmd.premium.deactivate.noSubscription'); } else {