Subcommand & Subcommand Groups (Discord.js + DJS-Commander)

Sdílet
Vložit
  • čas přidán 7. 09. 2024
  • Subcommand & Subcommand Groups (Discord.js + DJS-Commander)
    Previous Command Handler video: • Command + Event Handle...
    How to Host your Discord bot: • How to Host your Disco...
    Discord server: discord.underc...
    DJS-Commander documentation: djs-commander....
    Patreon: / underctrl
    Buy me a coffee (one-time donation): buymeacoffee.c...
    Thanks for watching :)

Komentáře • 19

  • @masonturner1320
    @masonturner1320 Před 8 měsíci +2

    You said there’s no way of making it look nicer, but I don’t think that’s true. Since subcommand, options, and subcommand groups are all just callback functions, you could just define them in individual files within a subcommand, option, or subcommand group directory, importing them where necessary.
    Furthermore, you can similarly implement the run() logic to conditionally run different functions imported from their respective subcommand files. You could even create a dynamic handler akin to the event and command handlers mentioned in the Discord.js docs that would get the interaction’s subcommand name, and then fetch a subcommand file based on its name.
    😊If anyone wants to implement this, I think it would make your code much more organized and easier to manage, and I’d be happy to help.

    • @rafasilva1265
      @rafasilva1265 Před 7 měsíci

      importing multiple times like this is not very good for performance, I've read. also makes things more confusing if there's an error.

  • @ayviuon
    @ayviuon Před 4 měsíci

    I didn't look if something like this existed, or if discord.js had it's own functionality for slash commands, so i ended up going through the pain of coding it myself 😭

  • @KryptoFPS
    @KryptoFPS Před rokem +1

    Please make a video on how to make a Channel Generator for discord. (This is when a user joins a channel to create their own)

  • @1989trouble07
    @1989trouble07 Před rokem +1

    Hello. I made it through to the end. I get the message on discord properly after running the slash command. But, the role is not actually being added to the user.
    The test user is the lowest roled in the server.

    • @singe7260
      @singe7260 Před rokem +1

      because it's not shown in the video

    • @UnderCtrl
      @UnderCtrl  Před rokem +2

      That command and subcommands in this video was just an example. It doesn't have any functionality other than replying to the person who executed the command.

  • @UselessKnowledge5
    @UselessKnowledge5 Před rokem

    I can’t register the command, I’m using DJS-commander

  • @nicooop656
    @nicooop656 Před rokem

    the option to add a user isn't showing for me

  • @airbauer
    @airbauer Před rokem +1

    love it

  • @ML3OBA-Gaming
    @ML3OBA-Gaming Před rokem

    What is the solution to this problem
    There was an error: DiscordAPIError[10004]: Unknown Guild

    • @UnderCtrl
      @UnderCtrl  Před rokem +1

      It probably means the bot hasn't joined the specific server in which you're trying to register slash commands.

    • @ML3OBA-Gaming
      @ML3OBA-Gaming Před rokem

      @@UnderCtrl Thank you very much ❣

  • @Robbiefrfr
    @Robbiefrfr Před rokem

    Thanks

  • @06prive
    @06prive Před rokem

    What extensions do you use on VSC?

    • @UnderCtrl
      @UnderCtrl  Před rokem

      ・Theme: Dark+ V2 (Built-in)
      ・Font family: Fira Code
      ・Icons theme: Material Icon Pack (or something like that)
      ・Code formatter: Prettier

    • @06prive
      @06prive Před rokem

      @@UnderCtrl and for the webpreview?