|
| 1 | +# CommandKit |
| 2 | + |
| 3 | +CommandKit is a library that makes it easy to handle commands (+ validations), and events in your Discord.js projects. |
| 4 | + |
| 5 | +**Supports Discord.js version 14** |
| 6 | + |
| 7 | +# Features |
| 8 | + |
| 9 | +- Very beginner friendly 🚀 |
| 10 | +- Support for slash and context menu commands ✅ |
| 11 | +- Automatic command registration, edits, and deletion 🤖 |
| 12 | +- Supports multiple development servers 🤝 |
| 13 | +- Supports multiple users as bot developers 👥 |
| 14 | +- Object oriented 💻 |
| 15 | + |
| 16 | +# Documentation |
| 17 | + |
| 18 | +You can find the full documentation [here](https://commandkit.underctrl.io) |
| 19 | + |
| 20 | +# Installation |
| 21 | + |
| 22 | +[](https://nodei.co/npm/commandkit/) |
| 23 | + |
| 24 | +To install CommandKit, simply run the following command: |
| 25 | + |
| 26 | +For npm: |
| 27 | + |
| 28 | +```bash |
| 29 | +npm install commandkit |
| 30 | +``` |
| 31 | + |
| 32 | +For yarn: |
| 33 | + |
| 34 | +```bash |
| 35 | +yarn add commandkit |
| 36 | +``` |
| 37 | + |
| 38 | +# Usage |
| 39 | + |
| 40 | +This is a simple overview of how to set up this library with all the options. You can read more in the [full documentation](https://commandkit.underctrl.io) |
| 41 | + |
| 42 | +```js |
| 43 | +// index.js |
| 44 | +const { Client, GatewayIntentBits } = require('discord.js'); |
| 45 | +const { CommandKit } = require('commandkit'); |
| 46 | +const path = require('path'); |
| 47 | + |
| 48 | +const client = new Client({ |
| 49 | + intents: [ |
| 50 | + GatewayIntentBits.Guilds, |
| 51 | + GatewayIntentBits.GuildMessages, |
| 52 | + GatewayIntentBits.MessageContent, |
| 53 | + ], |
| 54 | +}); |
| 55 | + |
| 56 | +new CommandKit({ |
| 57 | + // Your discord.js client object |
| 58 | + client, |
| 59 | + |
| 60 | + // Path to the commands folder |
| 61 | + commandsPath: path.join(__dirname, 'commands'), |
| 62 | + |
| 63 | + // Path to the events folder |
| 64 | + eventsPath: path.join(__dirname, 'events'), |
| 65 | + |
| 66 | + // Path to the validations folder (only valid if "commandsPath" was provided) |
| 67 | + validationsPath: path.join(__dirname, 'validations'), |
| 68 | + |
| 69 | + // Array of development server IDs (used to register and run devOnly commands) |
| 70 | + devGuildIds: ['DEV_SERVER_ID_1', 'DEV_SERVER_ID_2'], |
| 71 | + |
| 72 | + // Array of developer user IDs (used for devOnly commands) |
| 73 | + devUserIds: ['DEV_USER_ID_1', 'DEV_USER_ID_2'], |
| 74 | + |
| 75 | + // Array of developer role IDs (used for devOnly commands) |
| 76 | + devRoleIds: ['DEV_ROLE_ID_1', 'DEV_ROLE_ID_2'], |
| 77 | + |
| 78 | + // A property that disables CommandKit's built-in validations |
| 79 | + skipBuiltInValidations: true, |
| 80 | +}); |
| 81 | + |
| 82 | +client.login('YOUR_TOKEN_HERE'); |
| 83 | +``` |
0 commit comments