{"id":24549357,"url":"https://github.com/demirk2/discord-bot-js","last_synced_at":"2026-05-02T22:36:58.472Z","repository":{"id":273719477,"uuid":"673527608","full_name":"DemirK2/discord-bot-js","owner":"DemirK2","description":"A Discord.JS bot template","archived":false,"fork":false,"pushed_at":"2025-06-03T09:30:27.000Z","size":30,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-05T00:01:38.383Z","etag":null,"topics":["dc","discord","discord-bot","discord-js","discordbot","discordjs","djs"],"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/DemirK2.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-01T20:46:40.000Z","updated_at":"2025-05-23T19:41:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"f29d7ab4-9299-4ed3-8ec3-52d3c50380d0","html_url":"https://github.com/DemirK2/discord-bot-js","commit_stats":null,"previous_names":["demirk2/discord-bot-js"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/DemirK2/discord-bot-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemirK2%2Fdiscord-bot-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemirK2%2Fdiscord-bot-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemirK2%2Fdiscord-bot-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemirK2%2Fdiscord-bot-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DemirK2","download_url":"https://codeload.github.com/DemirK2/discord-bot-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemirK2%2Fdiscord-bot-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278886383,"owners_count":26062972,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dc","discord","discord-bot","discord-js","discordbot","discordjs","djs"],"created_at":"2025-01-23T00:15:14.239Z","updated_at":"2026-05-02T22:36:58.464Z","avatar_url":"https://github.com/DemirK2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord Bot JS\n\n\u003e ⚠️ **This repository is a template.**  \n\u003e Before running the bot you must configure the `.env` file with your own values.\n\n![Node.js](https://img.shields.io/badge/node-20+-green)\n![Discord.js](https://img.shields.io/badge/discord.js-v14-blue)\n![Database](https://img.shields.io/badge/database-MariaDB-orange)\n![Docker](https://img.shields.io/badge/docker-supported-blue)\n\nA modular **Discord bot template** built with:\n\n- Node.js\n- TypeScript\n- discord.js\n- MariaDB\n- Docker / Portainer support\n\nThis template is designed to be reused for **multiple bots**.\n\n---\n\n# Features\n\n- Slash commands\n- Prefix commands\n- MariaDB database\n- Automatic database initialization\n- Per-guild prefix system\n- Cooldown system\n- Bot owner system\n- Guild owner checks\n- Discord permission checks\n- Custom bot permission levels\n- Bot terms system\n- Bot user ban system\n- Docker / Portainer support\n- Modular architecture\n\n---\n\n# Project Structure\n\n```\nsrc\n│\n├── app.ts\n│\n├── core\n│   ├── client\n│   ├── config\n│   ├── database\n│   ├── guards\n│   ├── loaders\n│   ├── managers\n│   ├── types\n│   └── utils\n│\n├── commands\n│   ├── prefix\n│   └── slash\n│\n├── events\n│\n└── deploy\n```\n\n---\n\n# Quick Start\n\nRun the bot quickly:\n\n```\ngit clone https://github.com/DemirK2/discord-bot-js.git\ncd discord-bot-js\nnpm install\n```\n\nCopy the environment file:\n\n```\n.env.example → .env\n```\n\nEdit `.env`.\n\nThen run:\n\n```\nnpm run deploy\nnpm run dev\n```\n\nYour bot should now be online.\n\n---\n\n# Installation\n\nThe bot can run in three ways:\n\n- Local Node.js\n- Docker\n- Portainer\n\n---\n\n# Installation Without Docker (Local)\n\nClone the repository:\n\n```\ngit clone https://github.com/DemirK2/discord-bot-js.git\ncd discord-bot-js\n```\n\nInstall dependencies:\n\n```\nnpm install\n```\n\nCopy environment file:\n\n```\n.env.example → .env\n```\n\nExample `.env`:\n\n```\nDISCORD_TOKEN=\nCLIENT_ID=\nDEV_GUILD_ID=\nBOT_OWNER_IDS=\n\nPREFIX_DEFAULT=!\n\nDB_HOST=127.0.0.1\nDB_PORT=3306\nDB_USER=\nDB_PASSWORD=\nDB_NAME=\n```\n\nStart the bot:\n\n```\nnpm run dev\n```\n\nProduction:\n\n```\nnpm run build\nnpm start\n```\n\nDeploy commands:\n\n```\nnpm run deploy\n```\n\n---\n\n# Installation With Docker\n\nClone the repository:\n\n```\ngit clone https://github.com/DemirK2/discord-bot-js.git\ncd discord-bot-js\n```\n\nCopy environment file:\n\n```\n.env.example → .env\n```\n\nEdit `.env`:\n\n```\nDISCORD_TOKEN=\nCLIENT_ID=\nDEV_GUILD_ID=\nBOT_OWNER_IDS=\n\nPREFIX_DEFAULT=!\n\nDB_USER=\nDB_PASSWORD=\nDB_NAME=\n\nMARIADB_ROOT_PASSWORD=\n```\n\nStart containers:\n\n```\ndocker compose up -d --build\n```\n\nThis will start:\n\n- the bot\n- the MariaDB database\n\n---\n\n# Installation With Portainer\n\n1. Open **Portainer**\n2. Create a new **Stack**\n3. Paste the contents of `docker-compose.yml`\n4. Add environment variables:\n\n```\nDISCORD_TOKEN\nCLIENT_ID\nDEV_GUILD_ID\nBOT_OWNER_IDS\nDB_USER\nDB_PASSWORD\nDB_NAME\nMARIADB_ROOT_PASSWORD\n```\n\n5. Deploy the stack.\n\n---\n\n# Inviting the Bot\n\nTo invite the bot to your server:\n\nGet your **Client ID** from the Discord Developer Portal.\n\nInvite link format:\n\n```\nhttps://discord.com/oauth2/authorize?client_id=CLIENT_ID\u0026scope=bot%20applications.commands\u0026permissions=8\n```\n\nReplace `CLIENT_ID` with your actual client ID.\n\n---\n\n# Creating a Slash Command\n\nCreate a file in:\n\n```\nsrc/commands/slash/general/\n```\n\nExample:\n\n```\ntemplate.ts\n```\n\nExample command:\n\n```ts\nimport { SlashCommandBuilder, PermissionFlagsBits } from \"discord.js\";\nimport { SlashCommand } from \"../../../core/types/Command\";\n\nconst command: SlashCommand = {\n  data: new SlashCommandBuilder()\n    .setName(\"template\")\n    .setDescription(\"Example slash command\"),\n\n  cooldown: 5,\n\n  guildOnly: true,\n\n  permissions: [PermissionFlagsBits.Administrator],\n\n  botPermissions: 5,\n\n  async execute(client, interaction) {\n    await interaction.reply({\n      content: \"Template command executed.\",\n      ephemeral: true\n    });\n  },\n};\n\nexport default command;\n```\n\n---\n\n# Creating a Prefix Command\n\nCreate a file in:\n\n```\nsrc/commands/prefix/general/\n```\n\nExample:\n\n```\ntemplate.ts\n```\n\nExample command:\n\n```ts\nimport { PrefixCommand } from \"../../../core/types/Command\";\n\nconst command: PrefixCommand = {\n  name: \"template\",\n\n  cooldown: 5,\n\n  guildOnly: true,\n\n  botPermissions: 5,\n\n  async execute(client, message) {\n    await message.reply(\"Template prefix command executed.\");\n  },\n};\n\nexport default command;\n```\n\n---\n\n# Creating an Event\n\nCreate a file in:\n\n```\nsrc/events/\n```\n\nExample:\n\n```\nguildCreate.ts\n```\n\nExample event:\n\n```ts\nimport { Event } from \"../core/types/Event\";\n\nconst event: Event = {\n  name: \"guildCreate\",\n\n  async execute(client, guild) {\n    console.log(`Joined new guild: ${guild.name}`);\n  },\n};\n\nexport default event;\n```\n\n---\n\n# Using the Database\n\nDatabase connection is handled automatically.\n\nAccess it via:\n\n```\nsrc/core/database/db.ts\n```\n\nExample query:\n\n```ts\nimport { db } from \"../../core/database/db\";\n\nawait db.query(\n  \"INSERT INTO example_table (user_id) VALUES (?)\",\n  [userId]\n);\n```\n\n---\n\n# Bot Permission System\n\nUsers can have custom permission levels.\n\n| Level | Meaning |\n|------|--------|\n| 0 | normal user |\n| 3 | moderator |\n| 5 | admin |\n| 10 | bot owner |\n\nExample restriction:\n\n```\nbotPermissions: 5\n```\n\nUser must have permission level **5 or higher**.\n\n---\n\n# Bot Ban System\n\nUsers can be banned from using the bot.\n\nCommands:\n\n```\n/botban userID\n```\n\nCheck ban status.\n\n```\n/botban userID reason\n```\n\nToggle ban/unban.\n\n---\n\n# Cooldown System\n\nCommands can define cooldowns.\n\nExample:\n\n```\ncooldown: 10\n```\n\nUsers must wait **10 seconds** before using the command again.\n\n---\n\n# Command Restrictions\n\nCommands support several restrictions.\n\nExample:\n\n```ts\nguildOnly: true\ndmOnly: true\nguildOwnerOnly: true\nbotOwnerOnly: true\npermissions: [PermissionFlagsBits.Administrator]\nbotPermissions: 5\nbotTerms: true\n```\n\n---\n\n# Available Restrictions\n\n| Option | Description |\n|------|-------------|\n| cooldown | command cooldown |\n| guildOnly | server only |\n| dmOnly | DM only |\n| guildOwnerOnly | only server owner |\n| botOwnerOnly | only bot owners |\n| permissions | Discord permissions |\n| botPermissions | custom permission level |\n| botTerms | requires terms acceptance |\n\n---\n\n# Troubleshooting\n\n## Slash commands not appearing\n\nRun:\n\n```\nnpm run deploy\n```\n\nIf using `DEV_GUILD_ID`, commands appear instantly in that server.\n\nGlobal commands may take up to **1 hour**.\n\n---\n\n## Bot not starting\n\nCheck your `.env` file and verify:\n\n```\nDISCORD_TOKEN\nCLIENT_ID\n```\n\n---\n\n## Database errors\n\nMake sure MariaDB is running and check:\n\n```\nDB_USER\nDB_PASSWORD\nDB_NAME\n```\n\n---\n\n# Creating a New Bot From This Template\n\nClick **Use this template** on GitHub and create a new repository.\n\nClone your new bot:\n\n```\ngit clone https://github.com/YOUR_USERNAME/YOUR_NEW_BOT.git\n```\n\n---\n\n# Contributing\n\nContributions are welcome.\n\nTo contribute:\n\n1. Fork the repository\n2. Create a branch\n3. Make your changes\n4. Open a pull request\n\n---\n\n# Support\n\nIf you encounter issues:\n\n1. Check the **Troubleshooting** section\n2. Search existing issues\n3. Create a new issue if needed\n\nInclude:\n\n- Node.js version\n- OS\n- Error message\n- Steps to reproduce\n\n---\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemirk2%2Fdiscord-bot-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemirk2%2Fdiscord-bot-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemirk2%2Fdiscord-bot-js/lists"}