#permission issues

1 messages · Page 1 of 1 (latest)

twin hornet
#
const discord = require("discord.js")
const { REST } = require("@discordjs/rest")
const { Routes } = require("discord.js")

module.exports = async bot => {

    let commands = [];
    
    bot.commands.forEach(async command => {
        
        let slashcommand = new discord.SlashCommandBuilder()
        .setName(command.name)
        .setDescription(command.description)
        .setDMPermission(command.dm)

        if (command.permissions !== "Aucune") slashcommand.setDefaultMemberPermissions(command.permission);

        if(command.options?.lenght >= 1) {
            for(let i = 0; i < command.options.lenght; i++) {
                slashcommand[`add${command.options[i].type.slice(0, 1).toLowerCase() + command.options[i].type.slice(1, command.options[i].type.length)}Option`](option => option.setName(command.options[i].name).setDescription(command.options[i].description).setRequired(command.options[i].required))
            }
        }

        await commands.push(slashcommand)
    })

    const rest = new REST({version: "10"}).setToken(bot.token)
    await rest.put(Routes.applicationCommands(bot.user.id), {body: commands})
    console("Les SlashCommands sont crée avec succes")
}
solar meteor
#

thats the sollution ?

twin hornet
solar meteor
#

ok

solar meteor
#

there is the error

#
Uncaught CombinedError Error: Received one or more errors
    at BaseError (c:\Users\Kymaito\Desktop\support\node_modules\@sapphire\shapeshift\dist\index.js:174:17)
    at CombinedError (c:\Users\Kymaito\Desktop\support\node_modules\@sapphire\shapeshift\dist\index.js:985:5)
    at handle (c:\Users\Kymaito\Desktop\support\node_modules\@sapphire\shapeshift\dist\index.js:1085:23)
    at parse (c:\Users\Kymaito\Desktop\support\node_modules\@sapphire\shapeshift\dist\index.js:142:88)
    at validateDefaultMemberPermissions (c:\Users\Kymaito\Desktop\support\node_modules\@discordjs\builders\dist\interactions\slashCommands\Assertions.cjs:54:36)
    at setDefaultMemberPermissions (c:\Users\Kymaito\Desktop\support\node_modules\@discordjs\builders\dist\interactions\slashCommands\SlashCommandBuilder.cjs:46:40)
    at <anonymous> (c:\Users\Kymaito\Desktop\support\Loaders\loadSlashCommands.js:16:60)
    at module.exports (c:\Users\Kymaito\Desktop\support\Loaders\loadSlashCommands.js:9:18)
    at module.exports (c:\Users\Kymaito\Desktop\support\Events\ready.js:5:15)
    at emit (events:527:28)
    at triggerClientReady (c:\Users\Kymaito\Desktop\support\node_modules\discord.js\src\client\websocket\WebSocketManager.js:385:17)
    at checkShardsReady (c:\Users\Kymaito\Desktop\support\node_modules\discord.js\src\client\websocket\WebSocketManager.js:368:10)
    at <anonymous> (c:\Users\Kymaito\Desktop\support\node_modules\discord.js\src\client\websocket\WebSocketManager.js:194:14)
    at emit (events:527:28)
    at checkReady (c:\Users\Kymaito\Desktop\support\node_modules\discord.js\src\client\websocket\WebSocketShard.js:512:12)
    at onPacket (c:\Users\Kymaito\Desktop\support\node_modules\discord.js\src\client\websocket\WebSocketShard.js:484:16)
```
twin hornet
#

idk then

solar meteor
#

ahh

solar meteor
twin hornet
#

ok