Message Logger Documentation

📋 Overview

The Message Logger is a moderation tool that tracks and logs edited and deleted messages in your Discord server. It provides transparency and oversight by preserving message content, attachments, and metadata that would otherwise be lost when users edit or delete their messages.

Key Benefits

  • Accountability: Track message changes and deletions
  • Evidence Preservation: Save attachments from deleted messages
  • Moderation Transparency: Shows who deleted messages via audit log tracking
  • Configurable: Flexible channel exclusions and highlighting options
  • Automatic Safety: Auto-disables if channels become inaccessible

🚀 Quickstart

1. Set Up Log Channels

First, create dedicated channels for logs (recommended: restrict access to moderators only):

/messagelog set_channel edit #message-edit-logs
/messagelog set_channel delete #message-delete-logs

💡 Tip: You can use the same channel for both types, or separate them for organization.

2. Enable the Logger

Enable logging - the bot will automatically validate your configuration:

/messagelog enabled true

The bot will check:

  • ✅ At least one log channel is configured
  • ✅ Channels exist and are accessible
  • ✅ Bot has permission to send messages

If validation fails, you’ll see a detailed error message explaining what needs to be fixed.

3. Test It Out (Optional)

Send a test message in a regular channel, then edit or delete it. Check your log channels to verify it’s working!


✨ Features

Message Edit Logging

  • Records original and new content
  • Timestamps when message was sent and edited
  • Direct link to the message (for edits)
  • Optional diff highlighting to show what changed

Message Delete Logging

  • Preserves the deleted message content
  • Shows message ID and channel
  • Attempts to identify who deleted the message via audit logs
  • Downloads and re-uploads attachments from deleted messages

Attachment Preservation

  • Automatically downloads attachments from deleted/edited messages
  • Supports files up to 8MB
  • Re-uploads them to the log channel
  • Automatic cleanup of temporary files

Channel Exclusions

  • Exclude specific channels from logging (e.g., bot commands, staff channels)
  • Useful for privacy or reducing noise

Diff Highlighting

  • Optional feature for edit logs
  • Shows deleted content with strikethrough
  • Shows added content with bold
  • Makes it easy to spot what changed

Auto-Disable Protection

  • Validates channels before enabling
  • Prevents enabling without proper configuration
  • Auto-disables if log channels become inaccessible
  • Sends admin notification when auto-disabled

Mention Safety

  • Prevents role/everyone pings in logged messages
  • Messages containing mentions won’t re-ping when logged

⚙️ Configuration

Required Setup

At minimum, you must configure at least one log channel:

# For edit logs
/messagelog set_channel edit #edit-logs

# For delete logs  
/messagelog set_channel delete #delete-logs
# 1. Create log channels (do this in Discord first)
# 2. Configure both log types
/messagelog set_channel edit #message-edits
/messagelog set_channel delete #message-deletes

# 3. Exclude channels you don't want logged (optional)
/messagelog set_exclusion #bot-commands add
/messagelog set_exclusion #staff-chat add

# 4. Enable diff highlighting (optional)
/messagelog enable_highlighting True

# 5. Enable the logger (automatic validation)
/messagelog enabled true

Channel Permissions

Ensure the bot has these permissions in log channels:

  • ✅ View Channel
  • ✅ Send Messages
  • ✅ Embed Links
  • ✅ Attach Files

💡 Best Practice: Make log channels read-only for everyone except moderators and the bot.


🎮 Commands Reference

All commands are under /messagelog and require Administrator permission (except help).

/messagelog help

Shows comprehensive help information including current configuration, available commands, and features.

Example:

/messagelog help

/messagelog enabled <true/false>

Enable or disable the message logger.

Automatic Validation: Before enabling, the bot will automatically:

  • Check that at least one log channel is configured
  • Verify channels exist and are accessible
  • Confirm the bot has send message permissions

If validation fails, you’ll receive a detailed error message. Fix the issues and try enabling again.

Examples:

/messagelog enabled true   # Enable logging (with validation)
/messagelog enabled false  # Disable logging

/messagelog set_channel <edit/delete> <channel>

Configure which channel to send edit or delete logs to.

Parameters:

  • log_type: Choose edit or delete
  • channel: The text channel for logs

Examples:

/messagelog set_channel edit #message-edits
/messagelog set_channel delete #message-deletes
/messagelog set_channel edit #all-message-logs    # Use same channel for both

/messagelog set_exclusion <channel> <add/remove>

Add or remove channels from logging.

Use cases:

  • Exclude bot command channels
  • Exclude staff-only channels
  • Exclude high-traffic channels
  • Exclude channels with sensitive information

Examples:

/messagelog set_exclusion #bot-commands add
/messagelog set_exclusion #staff-lounge add
/messagelog set_exclusion #general remove

/messagelog list_exclusions

View all channels currently excluded from logging.

Example:

/messagelog list_exclusions

/messagelog enable_highlighting <True/False>

Toggle diff highlighting for edit logs.

When enabled:

  • Deleted text shown with strikethrough
  • Added text shown with bold
  • Makes changes easy to spot

When disabled:

  • Shows complete “before” and “after” text
  • Simpler, cleaner appearance

Examples:

/messagelog enable_highlighting True
/messagelog enable_highlighting False

🔧 Advanced Usage

Using Different Channels for Different Log Types

You can separate edit and delete logs for better organization:

# Create two channels
# #message-edits - for edit logs
# #message-deletes - for delete logs

/messagelog set_channel edit #message-edits
/messagelog set_channel delete #message-deletes

Strategic Channel Exclusions

Consider excluding:

  • Bot command channels: Reduce noise from command usage
  • Staff channels: Maintain staff privacy
  • Verification channels: These are often automated
  • High-volume channels: If they generate too many logs

Example setup:

/messagelog set_exclusion #bot-commands add
/messagelog set_exclusion #music-bot add
/messagelog set_exclusion #staff-only add
/messagelog set_exclusion #verify add

Attachment Handling

The bot will automatically:

  1. Download attachments from deleted messages (up to 8MB each)
  2. Re-upload them to the log channel
  3. List attachment metadata (filename, size)
  4. Clean up temporary files after sending

Note: Attachments larger than 8MB will be skipped with a warning in bot logs.

Audit Log Integration

For deleted messages, the bot attempts to identify who performed the deletion by:

  1. Waiting 0.5 seconds for audit log to populate
  2. Checking recent message delete entries
  3. Matching by author ID and channel ID
  4. Displaying in the log footer if found

Requirements:

  • Bot must have “View Audit Log” permission
  • Only works for mod-deleted messages (not self-deletions)
  • May be imprecise due to Discord API limitations

🚨 Troubleshooting

Logger Won’t Enable

Symptom: Error message when trying to enable

Solutions:

  1. The error message will tell you exactly what’s wrong
  2. Common issues:
    • No log channels configured: Use /messagelog set_channel first
    • Channels don’t exist or bot can’t access them
    • Bot lacks send message permissions in log channels
  3. Fix the issues mentioned in the error
  4. Try enabling again: /messagelog enabled true

Not Logging Any Messages

Possible Causes:

  1. Logger is disabled
    /messagelog enabled true
    
  2. Channel is excluded
    /messagelog list_exclusions
    # Remove if needed:
    /messagelog set_exclusion #channel-name remove
    
  3. Log channel not set or invalid
    • Configure at least one: /messagelog set_channel edit #channel
    • Try to enable and check the validation error message

Logger Auto-Disabled

What happened: The bot detected a configuration issue and automatically disabled logging to prevent errors.

You’ll receive: A notification in your command log channel explaining the issue.

How to fix:

  1. Read the auto-disable notification for specific issues
  2. Fix the identified issues (permissions, channel access, etc.)
  3. Try to re-enable - you’ll get validation feedback: /messagelog enabled true

Common causes:

  • Log channel was deleted
  • Bot lost send message permissions
  • Bot lost access to the channel
  • Channel was moved to a category the bot can’t access

Missing Attachments in Logs

Possible Causes:

  1. File too large: Files over 8MB are skipped
    • Check bot logs for “Skipping … - too large” messages
  2. Download failed: Network or Discord API issue
    • Temporary issue, should work next time
  3. Attachment expired: Discord attachments have limited lifetime
    • If message is very old, attachment URLs may be invalid

Can’t See Who Deleted Message

This is normal when:

  • User deleted their own message (no audit log entry)
  • Bot doesn’t have “View Audit Log” permission
  • Multiple deletions happened simultaneously (audit log ambiguity)

To improve:

  • Grant bot “View Audit Log” permission
  • Note: Self-deletions will never show a moderator

Diff Highlighting Not Working

Check:

  1. Highlighting is enabled: /messagelog enable_highlighting True
  2. Both before and after content exist (doesn’t work for empty → text or text → empty)

Note: Highlighting only applies to edit logs, not delete logs.


Too Many Logs / High Volume

Solutions:

  1. Exclude high-traffic channels
    /messagelog set_exclusion #general add
    /messagelog set_exclusion #memes add
    
  2. Use separate channels for edit vs delete logs
    • Put delete logs in higher-priority channel
    • Edit logs can be lower priority
  3. Adjust log channel permissions
    • Limit who can view logs
    • Use Discord’s search feature to find specific logs

❓ FAQ

Q: Does this log messages sent before the bot was added?

A: No, the bot can only log edits/deletes of messages that exist while the bot is running.


Q: Can users see when their messages are logged?

A: No, logging happens silently. The bot doesn’t notify users when their messages are logged.


Q: Will logging messages with @everyone mention actually ping everyone?

A: No, the bot uses allowed_mentions=none() to prevent any mentions from pinging when logged.


Q: How long are logs kept?

A: Logs are standard Discord messages in your log channels. They persist according to Discord’s retention and your server’s message history. You can manually delete old logs if needed.


Q: Can I use the same channel for both edit and delete logs?

A: Yes! Just set both to the same channel:

/messagelog set_channel edit #message-logs
/messagelog set_channel delete #message-logs

Q: Does this work in DMs?

A: No, the message logger only works in servers (guilds), not in DMs.


Q: What happens if the bot goes offline?

A: Messages edited or deleted while the bot is offline will not be logged. The bot can only log events it witnesses in real-time.


Q: Can I exclude specific users from being logged?

A: Not currently. You can only exclude entire channels. This is by design to ensure consistent accountability.


Q: How much space do attachments use?

A: Attachments are temporarily downloaded, then re-uploaded to Discord and immediately deleted from the bot’s storage. They don’t permanently use bot disk space, only Discord’s storage in your log channel.


Q: Can I get logs from before I enabled the logger?

A: No, the logger only captures edits and deletions that happen while it’s enabled and running.


Q: Why does it say “Message edited” for deleted messages?

A: It shouldn’t! If you see this, please report it as a bug. Delete logs should say “Message deleted”.


Q: Does this log edited embeds from bots?

A: The bot detects content and attachment changes. Embed edits by bots may not trigger logs unless the actual message content changed.


🛡️ Privacy & Security Considerations

What to Consider

  1. Transparency: Inform your server members that message logging is enabled
  2. Access Control: Restrict log channel access to moderators only
  3. Sensitive Information: Consider excluding channels where sensitive info might be shared
  4. Compliance: Ensure message logging complies with your jurisdiction’s privacy laws
  5. Data Retention: Periodically clean up old logs if needed
  • ✅ Mention logging in server rules
  • ✅ Restrict log channel permissions
  • ✅ Exclude staff/admin channels if desired
  • ✅ Regularly audit who has access to logs
  • ✅ Have a clear data retention policy

📞 Support

If you encounter issues not covered in this documentation:

  1. Try to enable the logger - validation errors will explain what’s wrong
  2. Check bot logs for error messages
  3. Verify bot permissions in both source and log channels
  4. Fix reported issues and try enabling again

For persistent issues, contact your bot administrator with:

  • The specific error message or behavior
  • What you were trying to do when the issue occurred
  • Screenshots of error messages if helpful