{"id":21681858,"url":"https://github.com/alvarocastro/discord-bot","last_synced_at":"2026-05-11T09:25:20.062Z","repository":{"id":72405665,"uuid":"323135925","full_name":"alvarocastro/discord-bot","owner":"alvarocastro","description":"Modular library to build powerful discord bots","archived":false,"fork":false,"pushed_at":"2021-01-08T02:09:06.000Z","size":165,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T11:26:19.348Z","etag":null,"topics":["bot","discord","discord-bot","discord-bot-framework","discord-bot-maker"],"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/alvarocastro.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":"2020-12-20T18:14:35.000Z","updated_at":"2021-10-26T08:13:27.000Z","dependencies_parsed_at":"2023-03-24T23:17:09.578Z","dependency_job_id":null,"html_url":"https://github.com/alvarocastro/discord-bot","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/alvarocastro%2Fdiscord-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarocastro%2Fdiscord-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarocastro%2Fdiscord-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarocastro%2Fdiscord-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alvarocastro","download_url":"https://codeload.github.com/alvarocastro/discord-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244600674,"owners_count":20479304,"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":["bot","discord","discord-bot","discord-bot-framework","discord-bot-maker"],"created_at":"2024-11-25T15:32:02.740Z","updated_at":"2026-05-11T09:25:20.021Z","avatar_url":"https://github.com/alvarocastro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# discord-bot\n\n[![NPM](https://img.shields.io/npm/v/@alvarocastro/discord-bot)](https://www.npmjs.com/package/@alvarocastro/discord-bot)\n[![Maintainability status](https://img.shields.io/codeclimate/maintainability/alvarocastro/discord-bot)](https://codeclimate.com/github/alvarocastro/discord-bot/maintainability)\n[![Code style: XO](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo)\n\nModular library to easily build powerful discord bots.\n\n- [Install](#install)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [Support](#support)\n\n## Install\n\n```bash\nnpm install @alvarocastro/discord-bot\n```\n\n## Usage\n\nJust instantiate the bot, make it login with your discord token and you are done!\n\n```js\n// index.js\nimport { Bot, commands } from '@alvarocastro/discord-bot';\n\nconst bot = new Bot({\n\tcommands: commands\n});\n\nbot.login('YOUR_DISCORD_TOKEN');\n```\n\nYou can pass an array of commands to the bot, the bot by itself has no commands but the library already comes with some simple (and boring) commands you can use, but you can easily build your own.\n\nLet's make a command to get cat images:\n\n```js\n// commands/cat.js\nimport { ChatCommand } from '@alvarocastro/discord-bot';\n\nexport default class CatCommand extends ChatCommand {\n\tconstructor () {\n\t\tsuper(...arguments);\n\t\tthis.name = 'cat'; // This will be used as the name to invoke the command, eg: !cat\n\t}\n\n\trun ({channel}, [count]) { // Our command will be able to accept a parameter, eg: !cat 3\n\t\tcount = Number(count);\n\t\tcount = count \u003e 1 ? count : 1;\n\n\t\tfor (let i = 0; i \u003c count; i++) {\n\t\t\tchannel.send('https://cataas.com/cat');\n\t\t}\n\t}\n}\n```\n\nDone! Our command is created, now we have to add it to our bot, let's go back to our `index.js` file.\n\n```js\n// index.js\nimport { Bot, commands } from '@alvarocastro/discord-bot';\nimport CatCommand from './commands/cat.js';\n\nconst bot = new Bot({\n\tcommands: [\n\t\t...commands,\n\t\tCatCommand\n\t]\n});\n\nbot.login('YOUR_DISCORD_TOKEN');\n```\n\nNow our bot is ready to fill our channels with cats!\n\n## Contributing\n\nContributions are always welcome! Feel free to fix any bug you find or propose commands to add to the bot.\n\n## Support\n\nIf you use this package please consider starring it :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarocastro%2Fdiscord-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falvarocastro%2Fdiscord-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarocastro%2Fdiscord-bot/lists"}