Skip to content

Commit

Permalink
fix(g-spy): add editable check
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperchupuDev committed Sep 28, 2021
1 parent bcb71e7 commit fa82db5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions commands/bot/g-spy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ module.exports = {
reason: 'Found a g-spy'
});

if (!role.editable) {
return message.channel.send({
embeds: [{
title: 'Missinq Permissions',
description: `Make sure ${role} is lower than my hiqhest role`,
color: client.config.color
}]
});
}

member.roles.add(role);
message.channel.send({
embeds: [{
Expand Down
11 changes: 11 additions & 0 deletions interactions/commands/g-spy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ module.exports = {
reason: 'Found a g-spy'
});

if (!role.editable) {
return interaction.reply({
embeds: [{
title: 'Missinq Permissions',
description: `Make sure ${role} is lower than my hiqhest role`,
color: client.config.color
}],
ephemeral: true
});
}

member.roles.add(role);
interaction.reply({
embeds: [{
Expand Down
11 changes: 11 additions & 0 deletions interactions/components/g-spy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ module.exports = {
const role = interaction.guild.roles.cache.find(r => r.name === 'g-spy');
const label = member ? 'Reverted' : 'Invalid User';

if (!role.editable) {
return interaction.reply({
embeds: [{
title: 'Missinq Permissions',
description: `Make sure ${role} is lower than my hiqhest role`,
color: client.config.color
}],
ephemeral: true
});
}

member?.roles.remove(role);

interaction.update({
Expand Down

0 comments on commit fa82db5

Please sign in to comment.