{"_id":"@baronvonalex/djs-commander","_rev":"3-aa069be6a232c88ae952adf0eb47712a","name":"@baronvonalex/djs-commander","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@baronvonalex/djs-commander","version":"1.0.0","keywords":["discord.js","discord","bot","command","handler","events","validations","slash-commands"],"author":{"name":"Your Name"},"license":"MIT","_id":"@baronvonalex/djs-commander@1.0.0","maintainers":[{"name":"baronvonalex","email":"aleko.kotliarovi@gmail.com"}],"homepage":"https://github.com/BaronVonAlex/djs-commander#readme","bugs":{"url":"https://github.com/BaronVonAlex/djs-commander/issues"},"dist":{"shasum":"cc0bedf4ee35c5d399ef9363aac072b68dcaa402","tarball":"https://registry.npmjs.org/@baronvonalex/djs-commander/-/djs-commander-1.0.0.tgz","fileCount":7,"integrity":"sha512-uWu/9kHNwTKcleiM+2SZ12Mk6YMlVZhpAJbbbpWicKjnZHtBJoTHlyLEfLP3sXmE9ynTW/LjqyKf702q6cjA0Q==","signatures":[{"sig":"MEYCIQCjjqqagDUSvCNh06RgNHgg8u6pufLaygPWGXtzGCiSkgIhAPPSecRyoGI4HAbfqcb+lzue3LQn0bgQ/ljScRBQsCZ2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34992},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"070e448835931dd43a087f8ec9be01323c1a0cf2","scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"tsup src/index.ts --format cjs,esm --dts --watch","prepare":"npm run build","prepublishOnly":"npm run build"},"_npmUser":{"name":"baronvonalex","email":"aleko.kotliarovi@gmail.com"},"repository":{"url":"git+https://github.com/BaronVonAlex/djs-commander.git","type":"git"},"_npmVersion":"10.9.2","description":"A modern command and event handler for Discord.js v14+","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","discord.js":"^14.14.0","typescript":"^5.3.0","@types/node":"^20.11.0"},"peerDependencies":{"discord.js":"^14.14.0"},"optionalDependencies":{"winston":"^3.11.0"},"_npmOperationalInternal":{"tmp":"tmp/djs-commander_1.0.0_1765386489924_0.03571194584646342","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@baronvonalex/djs-commander","version":"1.0.1","keywords":["discord.js","discord","bot","command","handler","events","validations","slash-commands"],"author":{"name":"Your Name"},"license":"MIT","_id":"@baronvonalex/djs-commander@1.0.1","maintainers":[{"name":"baronvonalex","email":"aleko.kotliarovi@gmail.com"}],"homepage":"https://github.com/BaronVonAlex/djs-commander#readme","bugs":{"url":"https://github.com/BaronVonAlex/djs-commander/issues"},"dist":{"shasum":"dddb49c9345dab37c6a778e52f84156a2efb0d61","tarball":"https://registry.npmjs.org/@baronvonalex/djs-commander/-/djs-commander-1.0.1.tgz","fileCount":7,"integrity":"sha512-JLUoGlKAerBXuoepH4C+zswq8c1bAvn3PB4zdBnhdeNau2QkCk5YYnRvITubcFA3KmLOUZbjO5StWDKrglqO8A==","signatures":[{"sig":"MEQCIFwD/cMpTbSDSijJcfFT7eQFBJwhl1fZSVXQwRKo6klBAiA1Ty1MvbRFOT6QEnChwGr6/kmZRNt1sHE6Jmxq1Nal9g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35006},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"32bb322205fdb81b68c04b0a2c3f8b96159df500","scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"tsup src/index.ts --format cjs,esm --dts --watch","prepare":"npm run build","prepublishOnly":"npm run build"},"_npmUser":{"name":"baronvonalex","email":"aleko.kotliarovi@gmail.com"},"repository":{"url":"git+https://github.com/BaronVonAlex/djs-commander.git","type":"git"},"_npmVersion":"10.9.2","description":"A modern command and event handler for Discord.js v14+","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","discord.js":"^14.14.0","typescript":"^5.3.0","@types/node":"^20.11.0"},"peerDependencies":{"discord.js":"^14.14.0"},"optionalDependencies":{"winston":"^3.11.0"},"_npmOperationalInternal":{"tmp":"tmp/djs-commander_1.0.1_1765386838090_0.4941270005412932","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@baronvonalex/djs-commander","version":"1.0.2","description":"A modern command and event handler for Discord.js v14+","types":"./dist/index.d.ts","main":"./dist/index.js","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","import":"./dist/index.mjs"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"tsup src/index.ts --format cjs,esm --dts --watch","prepublishOnly":"npm run build","prepare":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/BaronVonAlex/djs-commander.git"},"keywords":["discord.js","discord","bot","command","handler","events","validations","slash-commands"],"author":{"name":"BaronVonAlex"},"license":"MIT","peerDependencies":{"discord.js":"^14.14.0"},"devDependencies":{"@types/node":"^20.11.0","discord.js":"^14.14.0","tsup":"^8.0.0","typescript":"^5.3.0"},"optionalDependencies":{"winston":"^3.11.0"},"engines":{"node":">=18.0.0"},"_id":"@baronvonalex/djs-commander@1.0.2","gitHead":"820364305d83d2e10b60cfa7513bed7baab53668","bugs":{"url":"https://github.com/BaronVonAlex/djs-commander/issues"},"homepage":"https://github.com/BaronVonAlex/djs-commander#readme","_nodeVersion":"22.17.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-oVCQ054dTvavx0aqBvZWBm/6YLnsQhuBeiQwUL7oWEjTt7M616gdyoJ68Nv+W14oWvK/gUG5IoYomVlRU7Cxlw==","shasum":"14d4a8809bfc7b3f03ceb3b0da08e259c7d27cc0","tarball":"https://registry.npmjs.org/@baronvonalex/djs-commander/-/djs-commander-1.0.2.tgz","fileCount":7,"unpackedSize":35009,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCb8yWign9t9JeF2P0nqeozC7sbYL192BiTHNybKRMPxQIhAPW02GAwJZF+DwO3jJEPtNLAqOb0rDkuSXmHd2+DQ6DR"}]},"_npmUser":{"name":"baronvonalex","email":"aleko.kotliarovi@gmail.com"},"directories":{},"maintainers":[{"name":"baronvonalex","email":"aleko.kotliarovi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/djs-commander_1.0.2_1765387563403_0.6430885622775542"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-10T17:08:09.790Z","modified":"2025-12-10T17:26:03.735Z","1.0.0":"2025-12-10T17:08:10.058Z","1.0.1":"2025-12-10T17:13:58.293Z","1.0.2":"2025-12-10T17:26:03.537Z"},"bugs":{"url":"https://github.com/BaronVonAlex/djs-commander/issues"},"author":{"name":"BaronVonAlex"},"license":"MIT","homepage":"https://github.com/BaronVonAlex/djs-commander#readme","keywords":["discord.js","discord","bot","command","handler","events","validations","slash-commands"],"repository":{"type":"git","url":"git+https://github.com/BaronVonAlex/djs-commander.git"},"description":"A modern command and event handler for Discord.js v14+","maintainers":[{"name":"baronvonalex","email":"aleko.kotliarovi@gmail.com"}],"readme":"**This library is no longer maintained. Use [CommandKit](https://github.com/notunderctrl/commandkit) instead**\r\n\r\n# DJS-Commander: A Library for Discord.js Projects\r\n\r\nDJS-Commander is an easy-to-use JavaScript library that simplifies the process of handling commands, events, and validations in your Discord.js projects.\r\n\r\nDiscord.js version supported: `v14`\r\n\r\n## Documentation\r\n\r\nYou can find the full documentation [here](https://djs-commander.underctrl.io)\r\n\r\n## Installation\r\n\r\nTo install DJS-Commander, simply run the following command:\r\n\r\nFor npm:\r\n\r\n```bash\r\nnpm install djs-commander\r\n```\r\n\r\nFor yarn:\r\n\r\n```yarn\r\nyarn add djs-commander\r\n```\r\n\r\n## Usage\r\n\r\n```js\r\n// index.js\r\nconst { Client, IntentsBitField } = require('discord.js');\r\nconst { CommandHandler } = require('djs-commander');\r\nconst winston = require('winston');\r\nconst path = require('path');\r\n\r\nconst client = new Client({\r\n  intents: [IntentsBitField.Flags.Guilds], // Your bot's intents\r\n});\r\n\r\nconst logger = winston.createLogger({\r\n  // Optional highly customizable winston logger\r\n  level: 'info',\r\n  format: winston.format.json(),\r\n  transports: [new winston.transports.Console()],\r\n});\r\n\r\nnew CommandHandler({\r\n  client, // Discord.js client object\r\n  commandsPath: path.join(__dirname, 'commands'), // The commands folder\r\n  eventsPath: path.join(__dirname, 'events'), // The events folder\r\n  validationsPath: path.join(__dirname, 'validations'), // Only works if commandsPath is provided\r\n  testServer: 'TEST_SERVER_ID', // To register guild-based commands (if not provided commands will be registered globally)\r\n  logger: logger, // Changes the console output to match the specified logger configuration (if not provided logging will go through console.log)\r\n});\r\n\r\nclient.login('YOUR_TOKEN_HERE');\r\n```\r\n\r\n## File Structure\r\n\r\n### Commands\r\n\r\nDJS-Commander allows a very flexible file structure for your commands directory. Here's an example of what your file structure could look like:\r\n\r\n```shell\r\ncommands/\r\n├── command1.js\r\n├── command2.js\r\n└── category/\r\n\t├── command3.js\r\n\t└── commands4.js\r\n```\r\n\r\nAny file inside the commands directory will be considered a command file, so make sure it properly exports an object. Like this:\r\n\r\n```js\r\n// commands/misc/ping.js\r\nconst { SlashCommandBuilder } = require('discord.js');\r\n\r\nmodule.exports = {\r\n  data: new SlashCommandBuilder().setName('ping').setDescription('Pong!'),\r\n\r\n  run: ({ interaction, client, handler }) => {\r\n    interaction.reply(`Pong! ${client.ws.ping}ms`);\r\n  },\r\n\r\n  // deleted: true, // Deletes the command from Discord (if you passed in a \"testServer\" property it'll delete from the guild and not globally)\r\n};\r\n```\r\n\r\n- `interaction`\r\n- `client` is the discord.js Client instance.\r\n- `handler` is the CommandHandler instance. You can use this to get access to properties such as `commands`.\r\n\r\n---\r\n\r\n### Events\r\n\r\nDJS-Commander assumes a specific file structure for your events. Here's an example of what your file structure could look like:\r\n\r\n```shell\r\nevents/\r\n├── ready/\r\n|\t├── console-log.js\r\n|\t└── webhook.js\r\n|\r\n└── messageCreate/\r\n\t├── auto-mod/\r\n\t|\t├── delete-swear-words.js\r\n\t|\t└── anti-raid.js\r\n\t|\r\n\t└── chat-bot.js\r\n```\r\n\r\nMake sure each file exports a default function. Like this:\r\n\r\n```js\r\n// events/ready/console-log.js\r\nmodule.exports = (argument, client, handler) => {\r\n  console.log(`${client.user.tag} is online.`);\r\n};\r\n```\r\n\r\n- `argument` is the argument you receive from the event being triggered (you can name this whatever you want). For example, the `messageCreate` event will give you an argument of the message object.\r\n- `client` is the discord.js Client instance.\r\n- `handler` is the CommandHandler instance. You can use this to get access to properties such as `commands`.\r\n\r\n---\r\n\r\n### Validations\r\n\r\nDJS-Commander allows you to organize your validation files however you want to. Functions inside these files are executed in ascending order so you can prioritize your validations however you see fit. Here’s an example of what your file structure could look like:\r\n\r\n```shell\r\nvalidations/\r\n└── dev-only.js\r\n```\r\n\r\nMake sure each file exports a default function. Like this:\r\n\r\n```js\r\n// validations/dev-only.js\r\nmodule.exports = (interaction, commandObj, handler, client) => {\r\n  if (commandObj.devOnly) {\r\n    if (interaction.member.id !== 'DEVELOPER_ID') {\r\n      interaction.reply('This command is for the developer only');\r\n      return true; // This must be added to stop the command from being executed.\r\n    }\r\n  }\r\n};\r\n```\r\n\r\n- `interaction` is the interaction object.\r\n- `commandObj` is the command object exported from the command file itself. Properties such as `name`, `description` and `options` are all available within.\r\n- `handler` is the CommandHandler instance. You can use this to get access to properties such as `commands`.\r\n- `client` is the Client instance. (defined in your main entry point)\r\n\r\nIt's important to return `true` (or any truthy value) if you don't want the command to be executed (this also ensures the next validation that was queued up is not executed).\r\n","readmeFilename":"README.md"}