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

311
Views
Discord.js slash command permission system not working

This is the main code for the permission setting.

const run = (client) => __awaiter(void 0, void 0, void 0, function* () {
    const commandFiles = glob_1.default.sync(process.cwd() + "/src/commands/**/*{.ts,.js}");
    const guild = client.guilds.cache.get(config_json_1.default.guildId);
    commandFiles.map(value => {
        Promise.resolve().then(() => __importStar(require(value))).then((file) => __awaiter(void 0, void 0, void 0, function* () {
            exports.commands.set(file.info.name, file);
            const command = yield guild.commands.create(file.info);
            if (file.permission == undefined || file.permission == "@everyone")
                return;
            const json = (file.permission == "admin" ? {
                id: config_json_1.default.adminRole,
                permission: true,
                type: "ROLE"
            } : {
                id: config_json_1.default.freelancerRole,
                permission: true,
                type: "ROLE"
            });
            command.permissions.add({
                permissions: [json]
            });
        }));
    });

I have commissioned a dev for a discord bot and everything is working apart from the fact that anybody can use any command. He has a custom permission system that sets it with the above method. However, this does not work. I have debugged the config role ids, file.permission is set and he is positive it works. File.permission is set with exports.permission = "admin"; in a command file and defaultpermission is true.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Discord doesn't have permission called admin, you have to use ADMINISTRATOR permission instead!

about 4 years ago · Juan Pablo Isaza 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!