{"id":15213105,"url":"https://github.com/tguichaoua/djs-slash","last_synced_at":"2025-10-03T04:31:13.182Z","repository":{"id":46392740,"uuid":"391050591","full_name":"tguichaoua/djs-slash","owner":"tguichaoua","description":"An application command handler for discord.js v13","archived":true,"fork":false,"pushed_at":"2023-04-27T07:10:50.000Z","size":141,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-29T01:36:36.112Z","etag":null,"topics":["commandhandler","discord","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tguichaoua.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-30T12:06:35.000Z","updated_at":"2023-04-27T07:11:21.000Z","dependencies_parsed_at":"2024-09-15T07:27:49.653Z","dependency_job_id":"c36b081c-24f9-406f-81d4-3ae9cd9345b7","html_url":"https://github.com/tguichaoua/djs-slash","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":"0.33333333333333337","last_synced_commit":"5fdd00004870e60abf7035c8cf4cde25661c5428"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tguichaoua/djs-slash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tguichaoua%2Fdjs-slash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tguichaoua%2Fdjs-slash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tguichaoua%2Fdjs-slash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tguichaoua%2Fdjs-slash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tguichaoua","download_url":"https://codeload.github.com/tguichaoua/djs-slash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tguichaoua%2Fdjs-slash/sbom","scorecard":{"id":876219,"data":{"date":"2025-08-11","repo":{"name":"github.com/tguichaoua/djs-slash","commit":"5fdd00004870e60abf7035c8cf4cde25661c5428"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/npmpublish.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/tguichaoua/djs-slash/npmpublish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/tguichaoua/djs-slash/npmpublish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/tguichaoua/djs-slash/npmpublish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npmpublish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/tguichaoua/djs-slash/npmpublish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/tguichaoua/djs-slash/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/tguichaoua/djs-slash/test.yml/main?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   3 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"15 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T06:06:04.289Z","repository_id":46392740,"created_at":"2025-08-24T06:06:04.289Z","updated_at":"2025-08-24T06:06:04.289Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277624101,"owners_count":25849344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commandhandler","discord","nodejs","typescript"],"created_at":"2024-09-28T09:21:30.600Z","updated_at":"2025-10-03T04:31:12.881Z","avatar_url":"https://github.com/tguichaoua.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eDJS-SLASH\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003cspan\u003e\u003cimg alt=\"unmaintained\" src=\"https://img.shields.io/badge/status-unmaintained-lightgrey?style=for-the-badge\" height=\"20\"/\u003e\u003c/span\u003e\n    \u003ca href=\"https://www.npmjs.com/package/djs-slash\" target=\"_blank\"\u003e\n        \u003cimg alt=\"Version\" src=\"https://img.shields.io/npm/v/djs-slash.svg?style=for-the-badge\" height=\"20\"\u003e\n    \u003c/a\u003e\n     \u003ca href=\"https://github.com/tguichaoua/djs-slash/blob/main/LICENSE\" target=\"_blank\"\u003e\n        \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/github/license/tguichaoua/djs-slash?style=for-the-badge\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://node.green/#ES2021\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/node-%3E%3D16.6.0-blue.svg?style=for-the-badge\" height=\"20\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/discord.js\"\u003e\n        \u003cimg alt=\"Dependency discordjs\" src=\"https://img.shields.io/npm/dependency-version/djs-slash/peer/discord.js?style=for-the-badge\" height=\"20\"/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\ndjs-slash is a command handler for discord.js v13 that provides an easy command definition with file.  \n\n**Features**:\n- type checking (with TypeScript)\n- slash command\n- context menu command\n\n## Install\n\nInstall by running this command:\n\n```sh\nnpm i djs-slash\n```\n\n[`discord.js`](https://www.npmjs.com/package/discord.js) v13 is also required.\n\n## How to use\n\nProject architecture example\n```\n├ commands/                    (this folder contains all commands)\n| ├ slash/                     (slash command)\n| | ├ ping.ts\n| | └ cmd/\n| |   ├ subcommand.ts\n| |   └ subcommandgroup/\n| |     └ subcommand.ts\n| ├ user/                      (context menu commands on user)\n| | ├ hi.ts\n| | └ ban.ts\n| └ message/                   (context menu commands on message)\n|   ├ delete.ts\n|   └ repeat.ts\n└ index.ts\n```\n\n### Load commands\n```ts\nconst commands = SlashCommandManager.create({\n    commandFolder: './commands' // This is the path to the folder where command are stored relative to the entry point of the application (ie the index.ts file)\n});\n\n// If no parameter is provided, './commands' is used as default path\nconst commands = SlashCommandManager.create();\n```\n\n\n### Full script example\n\n```ts\nimport { Client, Intents } from \"discord.js\";\nimport { SlashCommandManager } from \"djs-slash\";\n\nconst GUILD_ID = '000000000000000000'\nconst BOT_TOKEN = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';\n\n// Create the djs client\nconst client = new Client({ intents: [Intents.FLAGS.GUILDS] });\n\n// Load all commands from ./commands/\nconst commands = SlashCommandManager.create();\n\nclient.once(\"ready\", async (client) =\u003e {\n    // Registering commands on a guild\n    const guild = await client.guilds.fetch(GUILD_ID);\n    await guild.commands.set(commands.toApplicationCommandData());\n\n    // Registering commands globally\n    await client.application.commands.set(commands.toApplicationCommandData());\n});\n\nclient.on(\"interactionCreate\", async (interaction) =\u003e {\n    // Pass the interaction to the SlashCommandManager to execute the command\n    if (await commands.execute(interaction)) {\n        // The interaction trigger a command\n    } else {\n        // The interaction didn't trigger a command.\n        // Either the interaction is not a command interaction\n        // either it didn't correspond to a registred command.\n    }\n});\n\n(async () =\u003e {\n    await client.login(BOT_TOKEN);\n})();\n```\n\n### Define a command\n\n#### Slash command\nSlash command files must be placed in a sub-folder named `slash` inside the command folder.  \nThe name of the file is the name of the command.  \nTo create sub-command and sub-command group use folder. Folder name is the name of the command/group.\n\nping example:\n```ts\nimport { SlashCommand } from 'djs-slash';\n\nexport default SlashCommand.define(\"Reply with 'pong'\", {}, async (interaction) =\u003e {\n    await interaction.reply({ content: ':ping_pong: pong !', ephemeral: true });\n});\n```\n\n```ts\nimport { SlashCommand } from \"djs-slash\";\n\n// Use SlashCommand.define to create your command\n// The value must be exported with `export default`\nexport default SlashCommand.define(\n    \"Reply with 'pong'\", // The description of the command\n    {\n        defaultPermission: true, // (optionnal) the defaultPermission option\n        // The arguments of the command\n        options: {\n            // Create a argument named 'foo'\n            foo: {\n                type: \"STRING\",\n                description: \"The foo argument\",\n                required: true,\n                choices: [\n                    { name: \"ping\", value: \"Ping\" },\n                    { name: \"pong\", value: \"Pong\" },\n                ] as const, // `as const` is required to resolve properly the type of the argument.\n            },\n            // Create a argument named 'bar'\n            bar: {\n                type: \"USER\",\n                description: \"A user to mention\",\n            },\n        },\n    },\n    // The callback of the function\n    // The first parameter is the CommandInteraction\n    // The second parameter is an object with the value of the argument\n    async (interaction, { foo, bar }) =\u003e {\n        // The type of the arguments are deduced from the value of `type` above.\n        // If the argument is not required (by default) the value can be null.\n        // foo : \"Ping\" | \"Pong\"\n        // bar : User | null\n        await interaction.reply(`:ping_pong: ${foo} !` + bar ? ` ${bar}` : \"\");\n    },\n);\n```\n\n\n`SlashCommand.define(description, options, callback)`  \n- `description` `string`: the description of the command.\n- `options` `{ defaultPermission, options }`\n    - [`defaultPermission`](https://discord.js.org/#/docs/main/stable/typedef/ApplicationCommandData) `boolean`: whether the command is enabled by default when the app is added to a guild.\n    - [`options`](https://discord.js.org/#/docs/main/stable/typedef/ApplicationCommandOptionData) `object`: the options of the command, key is the name of the options.\n        - `description` `string`: the description of the option.\n        - `required` `boolean`: whether the option is required.\n        - `type`: the type of the option.\n        - `choices`: the choices of the option for the user to pick from.\n        - `channelTypes`: when the option type is channel, the allowed types of channels that can be selected.\n- `callback` `(interaction, options) =\u003e void | Promise\u003cvoid\u003e`\n    - `interaction` [`CommandInteraction`](https://discord.js.org/#/docs/main/stable/class/CommandInteraction): the interaction object that trigger the command.\n    - `options` `object`: a key-value object where key is the name of the option and the value the value provided by the user.\n\n#### User command\nUser command files must be placed in a sub-folder named `user` inside the command folder.  \nThe name of the file is the name of the command.\n\nAn user command example:\n```ts\nimport { UserCommand } from 'djs-slash';\n\nexport default UserCommand.define(async (interaction, user) =\u003e {\n    await interaction.reply({ content: `Hi, ${user}` });\n});\n```\n`UserCommand.define(callback)`  \n- `callback` `(interaction, user) =\u003e void | Promise\u003cvoid\u003e`\n    - `interaction` [`ContextMenuInteraction`](https://discord.js.org/#/docs/main/stable/class/ContextMenuInteraction): the interaction object that trigger the command.\n    - `user` [`User`](https://discord.js.org/#/docs/main/stable/class/User): the target of the command.\n\n\n#### Message command\nMessage command files must be placed in a sub-folder named `message` inside the command folder.  \nThe name of the file is the name of the command.\n\nA message command example:\n```ts\nimport { MessageCommand } from 'djs-slash';\n\nexport default MessageCommand.define(async (interaction, message) =\u003e {\n    await interaction.reply({ content: message.content });\n});\n```\n`MessageCommand.define(callback)`  \n- `callback` `(interaction, message) =\u003e void | Promise\u003cvoid\u003e`\n    - `interaction` [`ContextMenuInteraction`](https://discord.js.org/#/docs/main/stable/class/ContextMenuInteraction): the interaction object that trigger the command.\n    - `user` [`Message`](https://discord.js.org/#/docs/main/stable/class/Message): the target of the command.\n\n\n## Example Project\nCheckout the example project to learn more.\n\nTo run the example project:\n\n1. clone the repo `git clone https://github.com/tguichaoua/djs-slash.git`\n2. go into the directory `cd djs-slash`\n3. install dependencies `npm ci`\n4. build the library `npm run build`\n5. go into the example directory `cd example`\n6. create a copy of `config.jsonc`, name it `config.json` and fill it up\n7. run the example bot `npm start`\n\n## Author\n\n👤 **Tristan Guichaoua**\n\n-   Github: [@tguichaoua](https://github.com/tguichaoua)\n\n## 📝 License\n\nCopyright © 2021 [Tristan Guichaoua](https://github.com/tguichaoua).\u003cbr /\u003e\nThis project is [MIT](https://github.com/tguichaoua/djs-slash/blob/main/LICENSE) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftguichaoua%2Fdjs-slash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftguichaoua%2Fdjs-slash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftguichaoua%2Fdjs-slash/lists"}