Skip to content

Commit

Permalink
fix(premium): Fix permissions for premium command
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Crespi committed Nov 26, 2019
1 parent 23f54d6 commit d89baa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions i18n/bot/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand All @@ -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": {
Expand Down
8 changes: 5 additions & 3 deletions src/framework/commands/premium/premium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
});
}
Expand Down Expand Up @@ -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`'
Expand All @@ -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 {
Expand Down

0 comments on commit d89baa2

Please sign in to comment.