This Discord bot facilitates a counting game within a designated channel in your server. Players take turns counting up based on specific rules for each round's mode. If a user counts incorrectly or out of turn, the bot resets the count and provides instructions for the new round.
- Counting Modes: Various modes such as positive, negative, multiples, primes, and binary numbers dictate how players count in each round.
- Error Handling: Detects invalid inputs and consecutive counts by the same user to maintain game integrity.
- Interactive Commands: Includes a /ping command to measure bot latency.
- Tutorial Embeds: Provides explanations for each mode via embedded messages.
To run the bot locally or deploy it to a server, follow these steps:
- Node.js (v18.0.0 or higher)
- npm (Node Package Manager)
- MySQL database
- Clone the repository:
git clone https://github.com/2000Arion/counting-discord-bot.git
cd counting-discord-bot
- Install dependencies:
npm install
- Set up environment variables:
Create a .env
file in the root directory with the following variables:
TOKEN=your_discord_bot_token
CLIENT_ID=your_discord_client_id
COUNTING_GUILD_ID=your_discord_guild_id
COUNTING_CHANNEL_ID=your_discord_channel_id
DB_HOST=your_mysql_host
DB_PORT=your_mysql_port
DB_USER=your_mysql_user
DB_PASSWORD=your_mysql_password
DB_NAME=your_mysql_database_name
DEV=true_or_false
TOKEN
: Your Discord bot token obtained from the Discord Developer Portal.CLIENT_ID
: The ID of your Discord bot client.COUNTING_GUILD_ID
: The ID of the Discord guild where the bot operates.COUNTING_CHANNEL_ID
: The ID of the channel where counting occurs.DB_HOST
,DB_PORT
,DB_USER
,DB_PASSWORD
,DB_NAME
: MySQL database connection details.DEV
: Optional variable to enable development/debug mode.
- Initialize the database:
Run the SQL script provided (schema.sql) to set up the required tables in your MySQL database.
Start the bot:
npm start
For development with automatic restart on file changes, use:
npm run dev
The bot will log in and be ready to operate in your Discord server.
/ping
: Responds with the bot's latency.
Contributions are welcome! If you have any suggestions or find issues, please create a pull request or open an issue.
This project is licensed under the MIT License. See the LICENSE file for more details.
- Discord.js: Discord API library for Node.js.
- MySQL: Database management system for storing game data.
- dotenv: Environment variable management for Node.js applications.
- nodemon: Development tool for auto-restarting the application on code changes.