{"id":25500207,"url":"https://github.com/serial/discord-testclient-bot","last_synced_at":"2025-11-11T16:30:22.334Z","repository":{"id":187962334,"uuid":"389547327","full_name":"serial/discord-testclient-bot","owner":"serial","description":"Discord Testclient","archived":false,"fork":false,"pushed_at":"2021-07-29T09:41:16.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-08-13T01:24:43.210Z","etag":null,"topics":["axios","discord-bot","discordjs"],"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/serial.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}},"created_at":"2021-07-26T07:31:50.000Z","updated_at":"2023-08-13T01:24:57.889Z","dependencies_parsed_at":"2023-08-13T01:39:49.583Z","dependency_job_id":null,"html_url":"https://github.com/serial/discord-testclient-bot","commit_stats":null,"previous_names":["serial/discord-testclient-bot"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serial%2Fdiscord-testclient-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serial%2Fdiscord-testclient-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serial%2Fdiscord-testclient-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serial%2Fdiscord-testclient-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serial","download_url":"https://codeload.github.com/serial/discord-testclient-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239593064,"owners_count":19664855,"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":["axios","discord-bot","discordjs"],"created_at":"2025-02-19T03:36:58.011Z","updated_at":"2025-11-11T16:30:22.295Z","avatar_url":"https://github.com/serial.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord bot | Testclient\n![npm](https://img.shields.io/npm/v/discord.js.svg)\n\n## About\n**A Testclient (discord bot) with some basic examples**\n\n\n- Settings like $prefix and $token from a config.json file.\n- Checks if prefix is set and user is not a bot.\n- Static reactions example.\n- Set the bot activity (type, options) with a returned embed message as example. \n- A quote (httpRequest) example with the axios library (Promise based HTTP client).\n\n\n#### Command handler\n- Reads the /commands folder of all *.js files and adds it to the `client.collection`.\n- An array of all commands are iterated, saved, and exported as `cmdList`.\n- The `cmdList` can hold any defined parameters from each file, for an easy output by the `help` command.\n- The commands 'testArgs' and 'testParams' are set to `hidden: true`, so they are not getting indexed in the cmdList.\n\n##### Separates command.name, prefix and args.\n```js\n// split args and get command name without prefix\nconst args = message.content.slice(prefix.length).split(/ +/);\nconst commandName = args.shift().toLowerCase();\n\nif (!client.commands.has(commandName)) return;\nconst command = client.commands.get(commandName);\n};\n```\n\n##### Check if a command requires arguments and handles the reaction\n\n```js\n// version.js\nmodule.exports = {\n    name: \"version\",\n    description: \"shows bot info\",\n    args: false,\n    usage: \"shows bot info\",\n    execute(message) {\n    ...\n    }\n};\n```\n\n```js\n// app.js\nif (command.args \u0026\u0026 !args.length) {\n        let reply = `You didn't provide any arguments, ${message.author}!`;\n\n        if (command.usage) {\n            reply += `\\nThe proper usage would be: \\`${prefix}${command.name} ${command.usage}\\``;\n        }\n\n        return message.channel.send(reply);\n    }\n```\n\n##### Checks if a command is has set `admin: true` and verifies that the user is in the given list (config.json) of 'botAdminIds'.\n\n```js\n// inc/tools.js\nmodule.exports = {\n    isAdmin: function (user) {\n        //simplified version of if-else\n        return !!botAdminIds.includes(user);\n    }\n}\n```\n\n## Requires\n**Node \u003e 12.0.0**\n\n## Installation\n1. Install node.js from [nodejs.org](https://nodejs.org)\n2. Run `npm install` in the bot directory and make sure it passes.\n3. Create a [discord token](https://discord.com/developers/)\n   - If you don't know how to do it, look in the 'guides section' at the bottom\n   - Don't forget to join a server with the bot.\n3. Rename *config.json.example* to *config.json* and fill the placeholders\n4. After set up your `config.json` - run `node app.js` to run the bot!\n\n## Documentation\n[DiscordJS documentation](https://discord.js.org/#/docs)  \n\n## Tools\n[Discord Markdown](https://bots.ondiscord.xyz/info/markdown)   \n[Discord embed visualizer](https://leovoel.github.io/embed-visualizer/)\n\n## Guides\n[DE - Build a Discord Bot (Node.js)](https://www.digitalocean.com/community/tutorials/how-to-build-a-discord-bot-with-node-js-de)  \n[EN - Build a Discord Bot (Node.js)](https://www.digitalocean.com/community/tutorials/how-to-build-a-discord-bot-with-node-js)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserial%2Fdiscord-testclient-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserial%2Fdiscord-testclient-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserial%2Fdiscord-testclient-bot/lists"}