- 📍 Overview
- 📦 Features
- 📂 Structure
- 💻 Installation
- 🏗️ Usage
- 🌐 Hosting
- 📄 License
- 👏 Authors
This repository contains a Discord giveaway bot project designed to simplify giveaway management on Discord servers. It provides a comprehensive solution with features like automated giveaway creation, entry management, winner selection, and announcement capabilities. The project is built using a robust and scalable tech stack, including React, Node.js, PostgreSQL, and custom AI models.
Feature | Description | |
---|---|---|
⚙️ | Architecture | The codebase utilizes a modular architecture, with distinct directories for commands, events, services, models, and utilities, ensuring maintainability and scalability. |
📄 | Documentation | This README file provides a comprehensive overview of the project, its features, dependencies, installation instructions, and usage examples. |
🔗 | Dependencies | The project relies on various external libraries such as Discord.js for interacting with the Discord API, Prisma for database management, Next.js for frontend development, and other packages for functionality. |
🧩 | Modularity | The codebase is highly modular, with each component and functionality separated into dedicated directories and files, promoting code reusability and maintainability. |
🧪 | Testing | Implement unit tests using Jest or React Testing Library to ensure the reliability and robustness of the codebase. |
⚡️ | Performance | The bot is optimized for performance using caching mechanisms, efficient database queries, and asynchronous operations to minimize latency and improve responsiveness. |
🔐 | Security | Security measures include input validation, sanitization, and secure API integration, protecting against vulnerabilities and ensuring data privacy. |
🔀 | Version Control | The project uses Git for version control, with a GitHub Actions workflow for automated build and deployment processes. |
🔌 | Integrations | The bot seamlessly integrates with the Discord API for interactions and data retrieval. It may also integrate with external services like payment gateways or prize delivery platforms. |
📶 | Scalability | The bot is designed for scalability to handle increasing user traffic and data volume. This includes database optimization, caching, and the potential for horizontally scaling the server infrastructure. |
├── src
│ ├── commands
│ │ ├── create.js
│ │ ├── enter.js
│ │ ├── end.js
│ │ ├── winners.js
│ │ ├── help.js
│ │ └── dashboard.js
│ ├── events
│ │ ├── ready.js
│ │ ├── message.js
│ │ └── interactionCreate.js
│ ├── services
│ │ ├── giveawayService.js
│ │ ├── databaseService.js
│ │ ├── discordService.js
│ │ └── notificationService.js
│ ├── models
│ │ ├── Giveaway.js
│ │ ├── User.js
│ │ └── Prize.js
│ ├── utils
│ │ ├── commandHandler.js
│ │ ├── logger.js
│ │ ├── errorHandler.js
│ │ └── randomWinnerSelector.js
│ ├── config
│ │ ├── env.config.js
│ │ └── database.config.js
│ ├── routes
│ │ ├── api.js
│ │ └── authRoutes.js
│ ├── middleware
│ │ ├── authentication.js
│ │ ├── authorization.js
│ │ └── logging.js
│ └── prisma
│ └── schema.prisma
├── public
│ ├── index.html
│ ├── favicon.ico
│ ├── robots.txt
│ └── manifest.json
├── next.config.js
├── tsconfig.json
└── README.md
- Node.js (v18+)
- npm
- Docker
- Clone the repository:
git clone https://github.com/spectra-ai-codegen/discord-giveaway-bot.git
- Navigate to the project directory:
cd discord-giveaway-bot
- Install dependencies:
npm install
- Start the development server:
npm start
- Open your browser and navigate to http://localhost:3000.
Adjust configuration settings in config.js
or .env
.
-
📝 Example 1: Creating a new giveaway
/create
command with arguments for prize, duration, entry requirements, and number of winners.
-
📝 Example 2: Entering a giveaway
/enter
command with the giveaway ID.
-
📝 Example 3: Ending a giveaway
/end
command with the giveaway ID (only for admins).
-
📝 Example 4: Viewing winners
/winners
command with the giveaway ID.
-
📝 Example 5: Accessing the admin dashboard
/dashboard
command (redirects to the web interface).
- Install the Heroku CLI:
npm install -g heroku
- Login to Heroku:
heroku login
- Create a new Heroku app:
heroku create
- Deploy the code:
git push heroku main
DISCORD_BOT_TOKEN
: Your Discord bot token.DATABASE_URL
: Your PostgreSQL database connection string.NEXTAUTH_SECRET
: Your NextAuth.js secret key.
- POST /api/giveaways: Creates a new giveaway.
- GET /api/giveaways/:id: Retrieves a specific giveaway.
- PUT /api/giveaways/:id: Updates a giveaway.
- DELETE /api/giveaways/:id: Deletes a giveaway.
- POST /api/giveaways/:id/enter: Enters a giveaway.
- POST /api/giveaways/:id/end: Ends a giveaway.
Use JWT tokens for authentication to access the API.
curl -X POST -H "Content-Type: application/json" -d '{"prize": "Discord Nitro", "duration": 86400, "entryRequirements": [], "numberOfWinners": 1}' http://localhost:3000/api/giveaways
This project is licensed under the GNU AGPLv3.
- Author Name - Spectra.codes
- Creator Name - DRIX10
Why only generate Code? When you can generate the whole Repository!