npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@discordjs-cli/discordjs-cli

v1.1.0

Published

A CLI for creating Discord.js bots with ease

Downloads

110

Readme

⚠️ BETA RELEASE ⚠️

A CLI for creating Discord.js bots with ease.

Main updates:
  • Added: n/a
  • Bug fix: n/a
  • Update: config.json is now config.js/config.ts for use with intellisense

Report bugs here


⚙️ Installation:

NOTE: You'll need to install the CLI globally in order for it to work. Nodemon is used to run the projects, so go ahead and install that as well.

Node v16+ is required
sudo npm i -g @discordjs-cli/discordjs-cli
sudo npm install -g nodemon

🌚 Create a project

Supported frameworks:

  • JavaScript
  • TypeScript

Initiate a new project like so:

djs new <project name>

This will walk you through the setup process of creating a new Discord.js, or Discord.ts bot.

Once your bot has been made, you can cd into the bot directory. The bot itself is in the ./src folder. In the ./src folder, theres a config folder that has a config.js/ts file inside. Add your bots token, client ID, etc. and then run:

djs run

And your bot should be online!


🔨 Initiate a project

Initiate an existing project like so:

djs init

This will walk you through the process of initiating an existing project.

NOTE: This only works for projects with the proper file structure.

Once your bot has been initiated, you can run:

djs run

And your bot should be online!


😌 Add commands, buttons, menus, etc!

/Slash commands

NOTE: Slash commands need to be deployed in order for them to show up on discord

Create a slash command

To create a slash command, run the following command:

# alternatively, use djs g c <command-name>
djs generate command <command-name>

This will create a new slash command template in our ./src/interactions/slash_commands folder.

Adding a sub command

To create a subcommand, run the following command:

# alternatively, use djs g s <command-name/subcommand-name>
djs generate subcommand <command-name/subcommand-name>

Deploying slash commands

NOTE: By default, commands are run for DEV commands; to the guild specified in your config.js/ts file. Specify the -g flag in the command, ie. djs deploy -g, to run globally.

To deploy slash commands, run the following command:

djs deploy

Updating slash commands

To update slash commands, run the following command:

djs update

Deleting slash commands

NOTE: This does NOT delete any files. It simply sets the bots commands to an empty array.

To delete slash commands, run the following command:

djs delete

!Legacy commands

Create a legacy command

To create a legacy command, run the following command:

# alternatively, use djs g l <command-name>
djs generate legacy <command-name>

This will create a new legacy command template in our ./src/interactions/legacy_commands/ folder.


🔘 Buttons

Create a button

Button types:

  • Blank (blank button)
  • Role (reaction role button)

To create a button, run the following command:

# alternatively, use djs g b <button-id>
djs generate button <button-id>

Next, you'll be prompted for a row name:

> Row (default is button ID):

You can then choose which button template you want:

> Button type: (Use arrow keys)
❯ Blank 
  Role

Selecting "Blank" will create a blank template, while selecting "Role" will have one more prompt for a role ID:

> Role ID (leave blank to add later): 

And thats it! When a role with the button ID you provided is clicked, the newly created button handler will run!


📂 Menus

Create a menu

To create a menu, run the following command:

# alternatively, use djs g menu <menu-name/option-id>
djs generate menu <menu-name/option-id>

This will create a folder in our "./src/menus" directory with the "menu-name" name, if none exists, then create our menu option file. The newly created menu file will be triggered when a menu with the the menu ID and menu option we specified in the command is selected.


Misc commands

To check the version of djs, run the following command:

djs --version

To update the CLI, run the following command:

djs --update

This will run sudo npm i -g @discordjs-cli/discordjs-cli. Note, you may be prompted for your password as the command is run with sudo.


Im still working on getting this to version 1, but I hope theres an appeal for it! :D

If you've worked with the Angular CLI, then this will look familiar xD

I work on quite a few bots, and I thought for sure theres got to be a faster way to go about things. I present to you: the Discord.js CLI 🎉

TODO: Add modals, and the one clicky thingy i forgor what its called 💀

If you have any suggestions, feel free to add them to the discussions page on the GitHub repo! I want this to be the most epic thing since sliced bread :D