π Advanced Discord logging bot with comprehensive server monitoring, message tracking, and administrative controls
A comprehensive Discord bot for server logging with message tracking, user activity monitoring, and administrative controls.
- Real-time message logging from all channels
- Message edit tracking with before/after content
- Message deletion logging with original content
- Attachment tracking and logging
- Member join/leave notifications
- Role change tracking
- Voice channel activity logging
- User status and activity monitoring
- Configurable logging channels for different event types
- Toggle individual logging features on/off
- Customizable command prefixes
- Per-server configuration storage
- Setup wizard for easy initial configuration
- Multiple log channel support (separate channels for different log types)
- Rich embed formatting with timestamps and user avatars
- Comprehensive error handling and logging
- Rate limiting and permission checks
- Modular code structure for easy maintenance
- Python 3.8 or higher
- Discord.py library
- A Discord bot token from the Discord Developer Portal
- Clone the repository:
git clone https://github.com/duskdeveloper/discord-logging-bot.git
cd discord-logging-bot
- Install dependencies:
pip install discord.py
-
Create a Discord Application and Bot:
- Go to https://discord.com/developers/applications
- Click "New Application" and give it a name
- Go to the "Bot" section
- Click "Add Bot"
- Copy the bot token
-
Set up environment variables:
export DISCORD_BOT_TOKEN="your_bot_token_here"
Or create a .env
file:
DISCORD_BOT_TOKEN=your_bot_token_here
-
Invite the bot to your server:
- In the Discord Developer Portal, go to "OAuth2" > "URL Generator"
- Select "bot" scope
- Select required permissions: Administrator (or specific permissions)
- Use the generated URL to invite the bot
-
Run the bot:
python main.py
Use the setup wizard for easy configuration:
!log setup
!log channel <type> #channel-name
Available log types:
messages
- Regular message loggingedits
- Message edit trackingdeletions
- Message deletion trackingjoins
- Member join notificationsleaves
- Member leave notificationsroles
- Role change trackingvoice
- Voice channel activitydefault
- Fallback channel for all log types
!log toggle <feature>
Available features:
main
- Enable/disable all loggingmessages
- Message loggingedits
- Edit trackingdeletions
- Deletion trackingjoins
- Join notificationsleaves
- Leave notificationsroles
- Role changesvoice
- Voice activity
!log status
!log prefix <new_prefix>
!log help
- Show all available commands!log setup
- Run the setup wizard!log status
- View current configuration!log toggle <feature>
- Toggle logging features!log channel <type> <channel>
- Set log channel for specific type!log channels
- List all configured log channels!log clear <type>
- Clear log channel setting!log prefix <prefix>
- Change command prefix
!ping
- Check bot latency!info
- Display bot information
βββ bot/
β βββ __init__.py
β βββ core.py # Main bot class
β βββ events.py # Event handlers
β βββ commands.py # Command handlers
β βββ config.py # Configuration manager
β βββ logger.py # Logging system
β βββ utils.py # Utility functions
βββ config/
β βββ default_config.json # Default configuration
βββ main.py # Entry point
βββ README.md
The bot automatically creates configuration files in the config/
directory:
default_config.json
- Default settings for all servers{guild_id}.json
- Per-server configuration files
- New messages with content and attachments
- Message edits with before/after comparison
- Message deletions with original content
- Direct message tracking (optional)
- Member joins with account age
- Member leaves with role information
- Role assignments and removals
- Nickname changes
- Status updates
- Voice channel joins
- Voice channel leaves
- Voice channel switches
- Mute/deafen status changes
The bot requires the following Discord permissions:
- Read Messages
- Send Messages
- Embed Links
- Read Message History
- View Channels
- Manage Messages (for advanced features)
- View Audit Log (for detailed logging)
For issues and feature requests, please open an issue on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.