{"id":15045008,"url":"https://github.com/reinforz/cordmand","last_synced_at":"2025-10-24T22:30:55.940Z","repository":{"id":60135815,"uuid":"531843229","full_name":"Reinforz/cordmand","owner":"Reinforz","description":"A utility package for making discord-bot commands much easier to write with discord.js.","archived":false,"fork":false,"pushed_at":"2022-09-28T14:04:28.000Z","size":121,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-31T04:26:08.385Z","etag":null,"topics":["command-handler","discord-bot","discord-js","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@reinforz/cordmand","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/Reinforz.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}},"created_at":"2022-09-02T08:26:08.000Z","updated_at":"2024-11-26T13:01:44.000Z","dependencies_parsed_at":"2023-01-18T21:01:34.592Z","dependency_job_id":null,"html_url":"https://github.com/Reinforz/cordmand","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reinforz%2Fcordmand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reinforz%2Fcordmand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reinforz%2Fcordmand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reinforz%2Fcordmand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Reinforz","download_url":"https://codeload.github.com/Reinforz/cordmand/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238039755,"owners_count":19406395,"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","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":["command-handler","discord-bot","discord-js","typescript"],"created_at":"2024-09-24T20:51:20.746Z","updated_at":"2025-10-24T22:30:50.581Z","avatar_url":"https://github.com/Reinforz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cordmand\n\n## About\nA utility package for making discord-bot commands much easier to write with discord.js.\n\n## Usage Example\n\n#### Install this package:\n```bash\nnpm i @reinforz/cordmand\n```\nor,\n```bash\nyarn add @reinforz/cordmand\n```\n\n#### Example typescript file:\n```ts\nimport { Client, GatewayIntentBits } from \"discord.js\";\nimport { addCommands } from \"@reinforz/cordmand\";\nimport { Commands } from \"@reinforz/cordmand/types\";\n\n// initiate discord.js client\nconst client = new Client({\n  intents: [\n    GatewayIntentBits.Guilds,\n    GatewayIntentBits.GuildMessages,\n    GatewayIntentBits.MessageContent,\n    GatewayIntentBits.GuildMembers,\n  ],\n});\n\n// define your commands similar to\nconst commands: Commands = {\n  interactionCreate: [\n    // define interactions here\n    {\n      name: \"ping\",\n      cb: async (interaction) =\u003e {\n        await interaction.reply(\"Pong!\");\n      },\n    },\n    {\n      name: \"hello\",\n      message: {\n        content: \"hello\",\n        ephemeral: true,\n      },\n    },\n  ],\n\n  messageCreate: [\n    {\n      regex: /ping/i,\n      message: \"pong\",\n    },\n    {\n      regex: /hi/i,\n      // message can also be a callback function which can access the discord message object\n      message: (_, message) =\u003e `hello \u003c@${message.author.id}\u003e`,\n    },\n    {\n      regex: /bye/i,\n      message: (_, message) =\u003e `bye ${message.author.username}`,\n      reply: true, // uses discord's message.reply intead of just sending the message in the same channel\n    },\n    {\n      regex: /args/i,\n      message: (args) =\u003e `The arguments are: ${args.join(\", \")}`,\n      reply: true, \n    },\n  ],\n};\n\n// add commands to the client by calling the addCommands function provided by the client\naddCommands(client, commands, {\n  messageCommandPrefix: /^i!/i,\n  // Add your command prefix regex. Make sure to include ^ (starts with) in the regex\n});\n\n// login\nclient.login(process.env.BOT_TOKEN!);\n```\n\n#### Example with just using `makeDiscordClient` function:\n```ts\nimport { makeDiscordClient } from \"@reinforz/cordmand\";\nimport { Commands, MakeDiscordClientOptions } from \"@reinforz/cordmand/types\";\nimport { commands } from \"./some-file\"\n\nconst makeClientOptions: MakeDiscordClientOptions = {\n  botToken: process.env.BOT_TOKEN!,\n  clientOptions: {\n    intents: [\"Guilds\", \"GuildMessages\", \"MessageContent\", \"GuildMembers\"],\n  },\n  commands, // the same command object as previous one, It will work in the same way as the previous example\n  addCommandsOptions: {\n    messageCommandPrefix: /^i!/i,\n  },\n};\n\nmakeDiscordClient(makeClientOptions);\n```\n\n## Contributors\n\n- [imoxto](https://github.com/imoxto)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freinforz%2Fcordmand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freinforz%2Fcordmand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freinforz%2Fcordmand/lists"}