Skip to content

Project: Discord Bot for Multi-Game Entertainment. Created at https://spectra.codes, which is owned by @Drix10

Notifications You must be signed in to change notification settings

coslynx/discord-games-bot-expansion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


discord-games-bot-expansion

Versatile Discord bot to host and manage interactive games within Discord servers.

Developed with the software and tools below.

Language: TypeScript Framework: Discord.js Database: MySQL Cache: Redis

git-last-commit GitHub commit activity GitHub top language

πŸ“‘ Table of Contents

  • πŸ“ Overview
  • πŸ“¦ Features
  • πŸ“‚ Structure
  • πŸ’» Installation
  • πŸ—οΈ Usage
  • 🌐 Hosting
  • πŸ“„ License
  • πŸ‘ Authors

πŸ“ Overview

The repository contains a project called "discord-games-bot-expansion" that provides a comprehensive solution for creating an interactive Discord game bot. It leverages the power of TypeScript, Discord.js, MySQL, and Redis to deliver a rich and engaging gaming experience within Discord servers.

πŸ“¦ Features

Feature Description
βš™οΈ Architecture The codebase follows a modular architectural pattern, ensuring maintainability and scalability.
πŸ“„ Documentation This README file provides a detailed overview of the project, its dependencies, and usage instructions.
πŸ”— Dependencies The codebase relies on various external libraries and packages such as Discord.js, MySQL, Redis, and others.
🧩 Modularity The modular structure allows for easier maintenance and reusability of the code.
πŸ§ͺ Testing Implement unit tests to ensure the reliability and robustness of the codebase.
⚑️ Performance Performance is optimized through efficient code practices, database indexing, and caching.
πŸ” Security Robust security measures are implemented to protect user data and prevent unauthorized access.
πŸ”€ Version Control Utilizes Git for version control with GitHub Actions for automated build and release processes.
πŸ”Œ Integrations Seamlessly integrates with the Discord API, utilizing its features for bot functionality.
πŸ“Ά Scalability The bot is designed to handle increased user load and data volume, ensuring a smooth experience.

πŸ“‚ Structure

β”œβ”€β”€ commands
β”‚   β”œβ”€β”€ gameCommands.js
β”‚   β”œβ”€β”€ adminCommands.js
β”‚   β”œβ”€β”€ userCommands.js
β”‚   β”œβ”€β”€ helpCommands.js
β”‚   └── leaderboardCommands.js
β”œβ”€β”€ events
β”‚   β”œβ”€β”€ ready.js
β”‚   β”œβ”€β”€ messageCreate.js
β”‚   β”œβ”€β”€ guildMemberAdd.js
β”‚   └── interactionCreate.js
β”œβ”€β”€ games
β”‚   β”œβ”€β”€ hangman.js
β”‚   β”œβ”€β”€ trivia.js
β”‚   β”œβ”€β”€ wordle.js
β”‚   β”œβ”€β”€ cardGames.js
β”‚   └── customGames.js
β”œβ”€β”€ services
β”‚   β”œβ”€β”€ gameService.js
β”‚   β”œβ”€β”€ leaderboardService.js
β”‚   β”œβ”€β”€ adminService.js
β”‚   β”œβ”€β”€ userService.js
β”‚   └── databaseService.js
β”œβ”€β”€ utils
β”‚   β”œβ”€β”€ commandHandler.js
β”‚   β”œβ”€β”€ logger.js
β”‚   β”œβ”€β”€ errorHandler.js
β”‚   └── messageUtils.js
β”œβ”€β”€ config
β”‚   β”œβ”€β”€ config.js
β”‚   └── databaseConfig.js
└── .env
    └── package.json
    └── README.md

πŸ’» Installation

πŸ”§ Prerequisites

  • Node.js
  • npm
  • Docker

πŸš€ Setup Instructions

  1. Clone the repository:
    • git clone https://github.com/spectra-ai-codegen/discord-games-bot-expansion.git
  2. Navigate to the project directory:
    • cd discord-games-bot-expansion
  3. Install dependencies:
    • npm install

πŸ—οΈ Usage

πŸƒβ€β™‚οΈ Running the Project

  1. Start the development server:
    • npm start
  2. Open your browser and navigate to http://localhost:3000.

βš™οΈ Configuration

Adjust configuration settings in config.js or .env.

πŸ“š Examples

  • πŸ“ Example 1: /startgame hangman: Starts a hangman game.
  • πŸ“ Example 2: /leaderboard trivia: Displays the leaderboard for the trivia game.
  • πŸ“ Example 3: /addgame wordle: Adds the wordle game to the server's game library (admin command).

🌐 Hosting

πŸš€ Deployment Instructions

Using Docker

  1. Build the Docker image:
    • docker build -t discord-games-bot-expansion .
  2. Run the container:
    • docker run -d -p 3000:3000 discord-games-bot-expansion

Using a hosting platform

  1. Create a new app on the hosting platform (e.g., Heroku, AWS).
  2. Deploy the code using the hosting platform's instructions.

πŸ”‘ Environment Variables

  • DISCORD_TOKEN: Your Discord bot token.
  • DB_HOST: Database host.
  • DB_USER: Database user.
  • DB_PASS: Database password.

πŸ“œ API Documentation

πŸ” Endpoints

  • POST /api/games: Creates a new game.
  • GET /api/games: Retrieves a list of games.
  • POST /api/games/:gameId/start: Starts a game.
  • POST /api/games/:gameId/join: Joins a game.
  • POST /api/games/:gameId/leave: Leaves a game.
  • GET /api/leaderboard/:gameId: Retrieves the leaderboard for a game.

πŸ”’ Authentication

Use JWT tokens for authentication.

πŸ“ Examples

curl -X POST -H "Content-Type: application/json" \
  -d '{"name": "Hangman", "description": "Classic word guessing game.", "type": "word"}' \
  http://localhost:3000/api/games

curl -X GET http://localhost:3000/api/games

πŸ“œ License

This project is licensed under the GNU AGPLv3.

πŸ‘₯ Authors

🌐 Spectra.Codes

Why only generate Code? When you can generate the whole Repository!