{"id":19768311,"url":"https://github.com/matiasvlevi/discord-commandline","last_synced_at":"2025-04-30T16:34:10.835Z","repository":{"id":54261660,"uuid":"341106643","full_name":"matiasvlevi/Discord-CommandLine","owner":"matiasvlevi","description":"A Discord Bot that runs CMD commands, JS scripts \u0026 Custom Commands. ","archived":false,"fork":false,"pushed_at":"2021-07-23T22:15:10.000Z","size":86,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T03:11:36.260Z","etag":null,"topics":["cmd","command-line","discord","discord-bot","discord-js","windows"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/matiasvlevi.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":"2021-02-22T06:52:53.000Z","updated_at":"2025-02-06T19:45:37.000Z","dependencies_parsed_at":"2022-08-13T10:20:31.601Z","dependency_job_id":null,"html_url":"https://github.com/matiasvlevi/Discord-CommandLine","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2FDiscord-CommandLine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2FDiscord-CommandLine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2FDiscord-CommandLine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2FDiscord-CommandLine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matiasvlevi","download_url":"https://codeload.github.com/matiasvlevi/Discord-CommandLine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251742826,"owners_count":21636517,"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":["cmd","command-line","discord","discord-bot","discord-js","windows"],"created_at":"2024-11-12T04:37:14.166Z","updated_at":"2025-04-30T16:34:10.474Z","avatar_url":"https://github.com/matiasvlevi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord-CommandLine\nDiscord-CommandLine is a template for a discord bot, made to simply add custom commands \u0026 run CMD commands on the local machine.\n\n### Features\n* Create custom commands for a Discord bot.\n* Run windows CMD commands on your local machine.\n* Run JS scripts.\n\n### Requirements\n\n* Nodejs (npm)\n\n\u003cbr/\u003e\u003cbr/\u003e\n\n\n## Setup\n\n#### Step 1\nRun `setup.bat` to create all the base files \u0026 install dependencies.\n\u003cbr/\u003e\n\n#### Step 2\nAdd your bot token \u0026 the ID of your discord server channel in the `user/options.json` files. You can obtain a token from the [Discord Dev Protal](https://discord.com/developers/applications) after having created a new Application \u0026 Discord bot.\n```\n{\n    \"token\":\"\",\n    \"channel_ID\":\"\",\n    \"prefix\":\"$\",\n    \"allowJS\":\"true\",\n    \"log\":\"true\",\n    \"accessJS\": [],\n    \"accessCMD\": []\n}\n```\nSee how you can obtain your channel ID [here](https://www.swipetips.com/how-to-get-channel-id-in-discord/)\n\nSee how to obtain a Discord Bot \u0026 its token [here](https://www.writebots.com/discord-bot-token/)\n\n\u003cbr/\u003e\n\n#### Step 3 (Optional)\nAdd custom command bindings in the `user/commands.js` file.\n\n#### Step 4\nLaunch `run.bat` to start the bot.\n\n\u003cbr/\u003e\u003cbr/\u003e\n\n## Run Windows CMD commands\n\n#### $cmd\n```\n$cmd yourCMDcommand\n```\n\n##### Example\n\nUser input in discord channel :\n```\n$cmd dir\n```\nBot reply :\n```\nVolume in drive C is Windows\n Volume Serial Number is XXXX-XXXX\n\n Directory of C:\\Your\\Path\\to\\repo\\Discord-CommandLine\\build\n\n2021-02-24  09:47 AM    \u003cDIR\u003e          .\n2021-02-24  09:47 AM    \u003cDIR\u003e          ..\n2021-02-24  11:36 AM             3,312 index.js\n               1 File(s)          3,312 bytes\n               2 Dir(s)  74,909,536,256 bytes free\n```\n\n##### Add `\u0026\u0026` to write multiple cmd commands\n\ntry :\n```\n$cmd cd.. \u0026\u0026 dir\n```\n\n\u003cbr/\u003e\u003cbr/\u003e\n\n## Add Custom Commands\n\nAdd the custom commands in `user/commands.js`.\n\n```js\ncommands.add('COMMAND_NAME', function , permissions);\n```\n\n\u003cbr/\u003e\u003cbr/\u003e\n\n## Custom Command examples\n\n\n\n#### Simple command\n```js\ncommands.add('ping',() =\u003e (\n    'pong'\n));\n```\n\nUser input in discord channel :\n```\n$ping\n```\n\nBot reply :\n```\npong\n```\n\n\u003cbr/\u003e\n\n#### Command with arguments\n```js\ncommands.add('mult',(arg) =\u003e (\n    arg[0] * arg[1]\n));\n```\nUser input in discord channel :\n```\n$mult 4 5\n```\n\nBot reply :\n```\n20\n```\n\n\u003cbr/\u003e\n\n#### Command with no return\n```js\ncommands.add('loop',(arg) =\u003e {\n    for (let i = 0; i \u003c arg[0]; i++) {\n        msg.channel.send(i);\n    }\n});\n```\nUser input in discord channel :\n```\n$loop 4\n```\n\nBot reply :\n```\n0\n1\n2\n3\n```\n\n\u003cbr/\u003e\u003cbr/\u003e\n#### Add permissions to a command\n\n\n```js\ncommands.add('ping',(arg) =\u003e {\n    'pong'\n},['UserA','UserC']);\n```\n`UserB` would not be able to use this command while `UserA` \u0026 `UserC` can. You might want to disable `allowJS` because this allows for permissions changes.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## Run JS scripts\n\nThe `allowJS` property in `user/options.json` should be set to `\"true\"` for the feature to be enabled.\n\n#### Example\n\nUser input in discord channel :\n\n```\n    ```js\n        let a = 10;\n        let b = 4;\n        msg.channel.send(a+b);\n    ```\n```\n\nBot reply :\n```\n14\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatiasvlevi%2Fdiscord-commandline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatiasvlevi%2Fdiscord-commandline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatiasvlevi%2Fdiscord-commandline/lists"}