
DJ4H
This project is under the GNU GPL v3 license
All the projects in the AsyncCommunityDiscord organisation are used by the discord server
discord.gg/graven both by the moderators and the members.
Most of the contributors are part of the staff but the members are also allowed to contribute.
| Global information | |
|---|---|
| Description | DJ4H is a Discord bot designed to enhance server engagement. It includes features for tracking activity engagement, providing a dynamic and interactive experience for communities. |
| Collaborators | |
| Version | 1.0.0 |
DJ4H is a Discord bot designed for the "4-hour Game" on the Async - Community server (formerly Graven - Développement). Its primary purpose is to automate point counting.
Although designed for the Async - Community server, the bot can be used on other servers and can run on multiple servers simultaneously.
DJ4H implements a competitive timing game called "The 4h Game". Players compete by sending messages in a designated channel after a configurable delay period has passed since the last message.
- Automatic point counting
- Leaderboard image generation
- Player point management (set/view scores)
Required command parameters are shown in brackets ([required]) while optional parameters are in parentheses (
(optional)).
| Command | Description |
|---|---|
/config [channel] [delay] |
Sets the game channel and the required delay to score a point. Time prefixes: s (seconds), m (minutes), h (hours), d (days). |
/set [member] [score] |
Sets a member's score to the specified value. |
/dump_log |
Retrieves the bot's log file. |
| Command | Description |
|---|---|
/leaderboard |
Displays an image with the top 10 players. |
/score |
Shows your own score. |
- Python 3.9+
- Poetry (for dependency management)
- Clone the repository:
git clone https://github.com/AsyncCommunityDiscord/DJ4H.git cd DJ4H - Install dependencies with Poetry:
poetry install
Create a .env file in the project root with the following variables:
BOT_TOKEN=your_discord_bot_token
DEBUG_GUILD_ID=your_dev_server_id # Optional
DATABASE_PATH=dj4h.db # Optional, defaults to dj4h.dbBOT_TOKEN: Your Discord bot token (required).DEBUG_GUILD_ID: Discord server ID for development (optional).DATABASE_PATH: Path to the SQLite database file (optional).
# Run the bot
poetry run python main.py# Build and run with Docker Compose
docker-compose -f compose-prod.yml up -d# Build and run with Docker Compose
docker-compose up -d# Format code with Black
poetry run black .DJ4H/
├── main.py # Entry point
├── config.py # Configuration and logging
├── commands/ # Discord commands
│ ├── cogs/game.py # /leaderboard and /score commands
�� └── handler/events.py # Main game logic
├── utils/
│ ├── database/ # Database layer
│ │ ├── connection.py # SQLite connection
│ │ ├── schema.py # Data models
│ │ └── dao/ # Data Access Objects
│ └── image_generator.py # Image generation for leaderboard
└── docker/ # Docker configuration
The bot uses SQLite with three main tables:
guilds: Server configuration (channel, delay).users: User scores per server.messages: Message tracking for game logic.
To report bugs or request features, please create an issue on the GitHub repository.