fix(discord-bot): check for role position

This commit is contained in:
GramingFoxTeam
2022-11-18 12:47:56 +03:00
parent cc54931d4e
commit d332043b1a
2 changed files with 6 additions and 19 deletions

View File

@@ -11,7 +11,12 @@ export default {
.setName('Train Message')
.setType(ApplicationCommandType.Message),
async execute(interaction) {
if (!interaction.member.roles.cache.get(global.config.discord.trainRole))
// Prettier and ESLint doesn't like to play nicely here.
if (
interaction.member.roles.highest.position <
interaction.member.guild.roles.cache.get(global.config.discord.trainRole)
.position
)
return interaction.reply({
content: 'You don\'t have the permission to do this.',
ephemeral: true