- π 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!