{"id":15550585,"url":"https://github.com/tolga1452/discord.js-bot-template","last_synced_at":"2025-04-12T23:13:16.222Z","repository":{"id":177256861,"uuid":"659693724","full_name":"Tolga1452/discord.js-bot-template","owner":"Tolga1452","description":"A very simple bot template for discord.js library. Includes all modern features.","archived":false,"fork":false,"pushed_at":"2023-12-24T19:52:51.000Z","size":40,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T23:13:11.265Z","etag":null,"topics":["bot","discord","easy","i18n","internationalization","javascript","js","locale","localization","simple"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tolga1452.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":["Tolga1452"]}},"created_at":"2023-06-28T11:08:31.000Z","updated_at":"2024-04-08T11:28:14.000Z","dependencies_parsed_at":"2023-12-24T20:49:43.608Z","dependency_job_id":null,"html_url":"https://github.com/Tolga1452/discord.js-bot-template","commit_stats":null,"previous_names":["tolga1452/discord.js-bot-template"],"tags_count":4,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tolga1452%2Fdiscord.js-bot-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tolga1452%2Fdiscord.js-bot-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tolga1452%2Fdiscord.js-bot-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tolga1452%2Fdiscord.js-bot-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tolga1452","download_url":"https://codeload.github.com/Tolga1452/discord.js-bot-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643006,"owners_count":21138355,"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","easy","i18n","internationalization","javascript","js","locale","localization","simple"],"created_at":"2024-10-02T14:00:19.463Z","updated_at":"2025-04-12T23:13:16.204Z","avatar_url":"https://github.com/Tolga1452.png","language":"JavaScript","funding_links":["https://github.com/sponsors/Tolga1452"],"categories":[],"sub_categories":[],"readme":"# `discord.js` Bot Template\n\nThis is a template for a Discord bot. It is written in JavaScript and uses the `discord.js` library. It is designed to be easy to use and easy to modify.\n\n## Features\n\n| Feature |\n| --- |\n| ✅ Very easy and simple |\n| ✅ Supports most modern features such as slash commands, message components, modals... |\n| ✅ Localization |\n| ✅ Command Handler |\n| ✅ Built-in commands |\n| ✅ Error handler |\n| ✅ Custom logger |\n| ✅ Custom embeds |\n\n## Setup\n\n1. Clone this repository.\n2. Run `npm install` to install dependencies.\n3. Rename the `.env.example` file to `.env` and fill in the values.\n4. Fill in the values in `config.json`.\n5. Run `npm start` to start the bot.\n\n## Commands\n\n### Setting Up Commands\n\n1. Create a new file in the `src/commands` directory.\n2. Copy the following code into the file:\n\n```js\nconst { SlashCommandBuilder, ChatInputCommandInteraction } = require(\"discord.js\");\n\nmodule.exports = {\n    category: 'General', // The category the command belongs to. \"Owner\" and \"Developer\" are special categories. You can use anything as a category.\n    data: new SlashCommandBuilder() // The command data\n        .setName('command') // The name of the command\n        .setDescription('Command description'), // The description of the command\n    /**\n     * @param {ChatInputCommandInteraction} interaction \n     */\n    async execute(interaction) {\n        interaction.reply('Hello, world!');\n    }\n};\n```\n\n3. Fill in the values in the code.\n\n### Built-in Commands\n\n- `ping`: Replies with the bot's ping.\n- `help`: Replies with the help menu.\n- `eval`: Evaluates JavaScript code.\n\n## Embeds\n\nWe use a custom embed class to make it easier to create embeds. It is similar to `discord.js`'s `EmbedBuilder` but with default values. You can find the class in `src/modules/embed.js`.\n\n### Creating an Embed\n\n```js\nconst EmbedMaker = require('../modules/embed.js');\n\nconst embed = new EmbedMaker(client) // You can use interaction.client in command files\n    .setTitle('Title')\n    .setDescription('Description')\n```\n\n## Localization\n\n### Adding a localization\n\n1. Find your language file in `src/i18n` and open it. If it doesn't exist, create it.\n2. Copy the following code into the file:\n\n```js\nmodule.exports = {\n    MY_LOCALIZED_TEXT: 'My localized text',\n    // ...\n};\n```\n\n3. Fill in the values in the code.\n4. Add your language to the `locales` object in `src/modules/localization.js`.\n\n### Using a localization\n\n```js\nconst { localize } = require('../modules/localization.js');\n\nconsole.log(localize('en-US', 'MY_LOCALIZED_TEXT')); // Replace 'en-US' with the language code of your language file.\n```\n\n## Logger\n\nWe use a custom logger class to make it easier to log messages. You can find the class in `src/modules/logger.js`.\n\n### Logging a message\n\n**Method Usage:** `logger(type, title, ...messages)`\n\n```js\nconst logger = require('../modules/logger.js');\n\nlogger('warning', 'COMMAND', 'Command', 'eval', 'blocked for', 'tolgchu', 'because it is developer only');\n```\n\nAccording to the above code, the logger will highlight \"eval\" and \"tolgchu\" parts.\n\n![Logger example](./assets/logger_example.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftolga1452%2Fdiscord.js-bot-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftolga1452%2Fdiscord.js-bot-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftolga1452%2Fdiscord.js-bot-template/lists"}