A robust and scalable framework for creating Discord bots using TypeScript. This framework leverages the power of Discord.js v14 to provide a structured and efficient way to build bots with modern JavaScript/TypeScript features.
- TypeScript Support: Write clean and type-safe code with TypeScript.
- Modular Structure: Easily organize commands, events, and other bot logic.
- Hot Reloading: Automatically reload your bot during development with
tsc-watch. - Prettier Integration: Maintain consistent code formatting.
- Environment Configuration: Use
.envfiles to manage sensitive data like tokens and API keys.
Before you begin, ensure you have the following installed:
git clone https://github.com/ramos350/Bot-Framework.git
cd Bot-Frameworknpm installOr, if you're using bun:
bun installCreate a .env file in the root directory and add the following:
DISCORD_TOKEN=your-bot-tokenReplace your-bot-token with your actual Discord bot credentials.
Head to config.ts file in the src directory and change the following:
export const owners = ['your-id'];
export const clientId = 'your-bot-id';
export const prefix = 'your-bot-prefix';
export const loadersConfig = {
messageCommandLoader: true, // To enable Prefix Command Loader
interactionCommandLoader: false, // To Enable Interaction Command Loader
eventLoader: true // To Enable Listener Loader
};npm run watchnpm run build
npm startOr, using bun:
bun run dev.
├── src
│ ├── commands # Command files
│ ├── events # Event handlers
│ ├── utils # Utility functions
│ ├── index.ts # Entry point
├── dist # Compiled JavaScript files
├── .env # Environment variables
├── package.json # Project metadata and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentation
The following scripts are available in the package.json:
npm start: Run the bot in production mode.npm run build: Compile TypeScript files to JavaScript.npm run watch: Start the bot in development mode with hot reloading.npm run format: Format the codebase using Prettier.
Contributions are welcome! If you find any issues or have suggestions for improvement, feel free to:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request.
-
Bot Not Responding:
- Ensure the bot token in the
.envfile is correct. - Verify that the bot is added to the server with the correct permissions.
- Ensure the bot token in the
-
TypeScript Errors:
- Run
npm run buildto check for compilation errors. - Ensure your TypeScript version matches the one in
devDependencies.
- Run
-
Dependencies Not Found:
- Run
npm installto install missing dependencies.
- Run
This project is licensed under the ISC License.
- Discord.js for the amazing library.
- TypeScript for making JavaScript development better.
- The open-source community for inspiration and contributions.