Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

298
Views
How do I make me bypass permission restrictions

I have a command and I want to make one of my commands to bypass the locked permissions..

How do I make the code bypass the permission restrictions with my id?

Code:

    if (!message.guild.me.hasPermission('BAN_MEMBERS')) return message.reply('I don\'t have permission to ban members!', { allowedMentions: { repliedUser: false } });
    if (!message.member.hasPermission('BAN_MEMBERS')) return message.reply('You don\'t have permission to ban members!', { allowedMentions: { repliedUser: false } });
    if (!args[0]) return message.reply('Provide someone to ban!', { allowedMentions: { repliedUser: false } });
    let check = false;
    const target = message.mentions.members.first() || await message.guild.members.fetch(args[0]).catch(e => {
        check = true;
        return message.reply('Can\'t find specefied member! Provide a valid id', { allowedMentions: { repliedUser: false } });
    });
    if (check) return;
    if(target.id === message.author.id) return message.reply('Why would you want to ban yourself?!', { allowedMentions: { repliedUser: false } });
    if(target.id === client.user.id) return message.reply('Why would you want to ban me?!', { allowedMentions: { repliedUser: false } });
    let reason = "No reason provided.";
    if (args[1]) reason = args.splice(1).join(" ");
    if (!target.bannable) return message.reply('Can\'t ban specified member! Make sure I\'m above them in the heirarchy', { allowedMentions: { repliedUser: false } });

            await target.ban({ reason: reason });
            const banEmbed = new MessageEmbed()
                 .setColor("#ff0000")
                                 .setFooter(message.guild.name, message.guild.iconURL())
                                 .addField("**Moderation**", "Ban")
                                 .addField("**Name**", `${target.user.tag}`)
                                 .addField("**Banned By**", message.author.username)
                                 .addField("**Reason**", `${reason || "**No Reason**"}`)
                                 .addField("**Date**", message.createdAt.toLocaleString())
                                 .setTimestamp();
            message.channel.send(banEmbed)
        }
    
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Your second line, the one that checks for the user's permissions is what you must update. Inside of the condition, also make sure that the user's id is not yours. Something like this

if(!message.member.hasPermission('BAN_MEMBERS') && message.author.id != "09128029381") return message.reply("no");
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!