Skip to content

[PLANNED]: Better error handling #197

@Cleboost

Description

@Cleboost

In devmod, check if command are valid before push

Connecting to Discord...
2 | import{Client as Et,Events as k,IntentsBitField as A}from"discord.js";import{SlashCommandBuilder as V}from"discord.js";class L{client;commands=[];contextMenus=[];guilds=[];rootIdCache=new Map;constructor(t){this.client=t}setGuilds(t){this.guilds=t}setCommands(t){this.commands=t}setContextMenus(t){this.contextMenus=t}async sync(){if(this.assertReady(),!this.client.application)throw Error("Client application is not available");let r=[...this.compileCommands(),...this.contextMenus];if(this.guilds.length>0)for(let e of this.guilds)try{let s=await this.client.application.commands.set(r,e);this.refreshCacheFromSetResult(s,e)}catch(s){if(s&&typeof s==="object"&&"code"in s&&s.code===10063)continue;throw s}else try{let e=await this.client.application.commands.set(r);this.refreshCacheFromSetResult(e,"global")}catch(e){if(e&&typeof e==="object"&&"code"in e&&e.code===10063)return;throw e}}compileCommands(){let t=new Set(this.commands.map((e)=>this.getRoot(e.route))),r=[];for(let e of t){let s=this.compileRoot(e);if(s)r.p | ... truncated 

TypeError: undefined is not an object (evaluating 'r.command.description')
      at getRootDescription (/home/cleboost/Documents/code/Bot-Discord/node_modules/@djs-core/runtime/dist/index.js:2:2303)
      at compileRoot (/home/cleboost/Documents/code/Bot-Discord/node_modules/@djs-core/runtime/dist/index.js:2:1590)
      at compileCommands (/home/cleboost/Documents/code/Bot-Discord/node_modules/@djs-core/runtime/dist/index.js:2:1013)
      at sync (/home/cleboost/Documents/code/Bot-Discord/node_modules/@djs-core/runtime/dist/index.js:2:460)
      at sync (/home/cleboost/Documents/code/Bot-Discord/node_modules/@djs-core/runtime/dist/index.js:2:891)
      at <anonymous> (/home/cleboost/Documents/code/Bot-Discord/node_modules/@djs-core/dev/dist/index.js:32:376)
      at <anonymous> (/home/cleboost/Documents/code/Bot-Discord/node_modules/@djs-core/dev/dist/index.js:32:559)
      at emit2 (node:events:126:31)
      at triggerClientReady (/home/cleboost/Documents/code/Bot-Discord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:401:17)
      at checkShardsReady (/home/cleboost/Documents/code/Bot-Discord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:368:10)
note: missing sourcemaps for /home/cleboost/Documents/code/Bot-Discord/node_modules/@djs-core/dev/dist/index.js
note: consider bundling with '--sourcemap' to get unminified traces

Bun v1.3.3 (Linux x64)
error: script "start" exited with code 1
󰪢 0s 󰜥 󰉋  ••/Bot-Disco

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions