#No matter what I set UserPerms as it taked it as administrator

39 messages · Page 1 of 1 (latest)

latent mica
#
module.exports = {
  name: "ban",
  description: "Ban a member",
  category: "Moderation",
  UserPerms: ["BanMembers"],
  BotPerms: ["BanMembers", "SendMessages", "ViewChannel"],
  maintenance: false,
  ownerOnly: false,

P.S. I have not overwrite the permissions
Here is my interactionCreate
https://srcb.in/6KlwlAhdBK
Please tell the error

hard spindle
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

latent mica
#

No matter what I set UserPerms as it taked it as administrator

keen idol
#

I dont understand the question, but how are you deploying this?

latent mica
#

I have the userPerms checked in my interactionCreate

keen idol
#

Okay

#

So you arent deploying any permissions

latent mica
#

But it says the userPerms are set to administrator while it is set as BanMembers

keen idol
#

Discord doesnt read stuff inside your code

willow mountainBOT
#

guide Slash Commands: Slash command permissions
read more

latent mica
keen idol
#

Because you didnt deploy anything correctly

#

That might still be bugged

#

I asked you to show how you deploy permissions

#

Checking them internally is not the correct approach at all

latent mica
latent mica
keen idol
#

No

#

Thats code is for when your bot receives an interaction

#

I want to see how you deployed it to Discord

latent mica
#
const { Perms } = require("../Validation/Permissions");
const { Client } = require("discord.js");
const ms = require("ms");

/**
 * @param { Client } client
 * @param { Ascii } Ascii
 */
module.exports = async (client, PG, Ascii) => {
  const Table = new Ascii("Commands Loaded");

  let CommandsArray = [];

  const CommandFiles = await PG(`${process.cwd()}/Commands/*/*.js`);

  CommandFiles.map(async (file) => {
    const command = require(file);

    if (!command.name)
      return Table.addRow(file.split("/")[7], "FAILED", "Missing a Name");
    if (!command.context && !command.description)
      return Table.addRow(command.name, "FAILED", "Missing a Description");
    if (command.UserPerms)
      if (command.UserPerms.every((perms) => Perms.includes(perms)))
        command.default_member_permissions = false;
      else
        return Table.addRow(
          command.name,
          "FAILED",
          "User Permission is Invalid"
        );

    client.commands.set(command.name, command);
    CommandsArray.push(command);

    await Table.addRow(command.name, "SUCCESSFUL");
  });

  console.log(Table.toString());

  client.on("ready", () => {
    setInterval(() => {
      client.guilds.cache.forEach((guild) => {
        guild.commands.set(CommandsArray);
      });
    }, ms("5s"));
  });
};
keen idol
#

yeah so this doesn't set permissions at all

#

Please read the guide i linked

latent mica
#

Thank you

unkempt sorrel
#

(don't deploy commands on ready)

unkempt sorrel
#

Your code above does

#

@keen idol I'm on mobile, is that whole forEach loop in a setInterval that sets it every 5ms

lean sandal
#

yep

unkempt sorrel
#

How is your bot not banned

keen idol
#

appears to be lmao

latent mica
#

umm

keen idol
#

Why the fuck does it do that

unkempt sorrel
#

Axe that code immediately and use a proper deploy script

#

The guide has one

latent mica
willow mountainBOT
#

guide Creating Your Bot: Registering slash commands
If you already have slash commands set up and deployed for your application and want to learn how to respond to them, refer to the following section on replying to slash commands.
read more