Skip to content

A πŸ”₯ TypeScript + discord.js template to kickstart your Discord bot project in no time! It includes MongoDB integration with Mongoose, command & event handlers, automatic slash command registration, and utility functions.

License

Notifications You must be signed in to change notification settings

Xjectro/typescript-discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ‰ Discord Bot Template πŸš€

A πŸ”₯ TypeScript + discord.js template to kickstart your Discord bot project in no time! It includes MongoDB integration with Mongoose, command & event handlers, automatic slash command registration, and utility functions.

✨ Features

  • ⚑️ Fast setup with TypeScript
  • πŸ“₯ Automatic slash command registration (registerCommands.ts)
  • πŸ”„ Robust event & command handlers
  • πŸ—„οΈ MongoDB integration via Mongoose
  • ⏱️ Cooldown mechanism for commands
  • πŸ–ΌοΈ Dynamic image generation using node-html-to-image

πŸ› οΈ Requirements

  • Node.js v18 or higher
  • Bun (optional) or Nodemon
  • MongoDB connection URI
  • Discord Bot Token

πŸš€ Installation

git clone https://github.com/<username>/discord-bot-template.git
cd discord-bot-template
# Using npm
npm install
# Or with Bun
bun install

πŸ”‘ Environment Variables

Create a .env file in the project root:

TOKEN=YOUR_DISCORD_BOT_TOKEN
MONGODB_URI=YOUR_MONGODB_CONNECTION_STRING

πŸ“‚ Project Structure

.
β”œβ”€ src  
β”‚  β”œβ”€ commands          # Slash command definitions  
β”‚  β”œβ”€ database  
β”‚  β”‚  β”œβ”€ dbConnection.ts  
β”‚  β”‚  └─ models         # Mongoose models  
β”‚  β”œβ”€ events            # Discord event handlers  
β”‚  β”œβ”€ handlers          # Custom event & command logic  
β”‚  β”œβ”€ types             # TypeScript type definitions  
β”‚  └─ utils             # Utility functions (e.g., cooldowns)  
β”œβ”€ templates            # HTML templates for image generation  
β”œβ”€ nodemon.json         # Nodemon config  
β”œβ”€ package.json  
β”œβ”€ tsconfig.json  
└─ README.md  

βš™οΈ Usage

Register commands

npm run registerCommands

Start development server

npm run dev

Or with Bun:

bun run dev

🀝 Contributing

  1. Fork the repository 🍴
  2. Create a new branch (git checkout -b feature/YourFeature) 🌿
  3. Commit your changes (git commit -m "Add some feature") πŸ“
  4. Push to the branch (git push origin feature/YourFeature) πŸš€
  5. Open a Pull Request πŸŽ‰

πŸ“„ License

This project is licensed under the ISC License. πŸš€

About

A πŸ”₯ TypeScript + discord.js template to kickstart your Discord bot project in no time! It includes MongoDB integration with Mongoose, command & event handlers, automatic slash command registration, and utility functions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published