How Console Relay Works
When a process starts, McDis-RCON:- Creates a dedicated Discord thread named
Console <process_name> - Captures stdout and stderr from the process
- Filters logs based on configured blacklist
- Formats and batches logs for Discord
- Sends logs to the thread as code blocks
Console Thread Structure
Each configured process gets its own console thread:Console threads are created as public threads when McDis-RCON initializes, allowing all channel members to view and interact with them.
Console Output Format
Logs are displayed as Markdown code blocks for readability:Log Processing
Before sending to Discord, logs undergo processing:- ANSI color codes are stripped (
[0m,[31m, etc.) - Empty lines are filtered out
- Blacklisted terms are checked
- Remaining logs are queued for relay
- Logs are sent to plugins for event processing
Batching and Rate Limiting
To prevent Discord API rate limiting, logs are batched:- Up to 10 logs are combined into a single message
- If queue has < 10 logs, wait 0.5 seconds before sending
- If queue has ≥ 10 logs, send immediately
- Each message is truncated to 1990 characters (Discord limit: 2000)
This batching mechanism ensures efficient Discord API usage while maintaining near-real-time output during high-traffic periods.
Queue Overflow Protection
If console output exceeds processing capacity, McDis protects against memory issues:- Queue is completely cleared
- Warning message is sent to console thread
- Log count of omitted messages is displayed
- Normal relay resumes
Log Filtering (Blacklist)
Filter out unwanted log messages using the blacklist configuration:- Blacklist checks are case-sensitive
- Partial matches work (“Debug” matches “[Debug] Something”)
- Blacklisted logs are still sent to plugins
- Empty strings in blacklist are ignored
Console Thread Commands
Send commands directly in console threads without any prefix:Process Control Commands
Server Commands
Any other text is sent directly to the server:Commands are written directly to the process stdin, exactly as if you typed them in the server console locally.
Special Console Features
Process Initialization
When a server starts, you’ll see:Process Shutdown
When a server stops:Error References
If an error occurs in a plugin or process:Plugin Reload
When reloading plugins withmdreload:
Thread Reconnection
If Discord connection is lost, McDis automatically reconnects:Console relay is resilient to network issues. If Discord API is temporarily unavailable, McDis will retry fetching the thread and continue streaming once connection is restored.
Console Thread Lifecycle
Thread Creation
When McDis-RCON starts, console threads are created for all configured processes, even if they’re not running.
Process Start
When process starts:
- “[Initializing Process…]” is sent
- Plugin loading messages appear
- Server console output begins streaming
Process Stop
When process stops:
- Remaining queued logs are sent
- “[Process Stopped]” is sent
- Thread remains open for commands
Character Escaping
Certain characters are escaped for Discord markdown compatibility:_(underscore) →⎽(prevents italic formatting)*(asterisk) →(space) (prevents bold formatting)`(backtick) →’(prevents code block breaking)
This escaping ensures that server logs display correctly in Discord without breaking markdown rendering.
Integration with Plugins
Every console log is sent to plugins for processing:listener_events to react to specific log patterns:
Performance Considerations
Memory Usage
- Console logs are stored in two queues:
_console_logand_console_relay - Queue size is monitored to prevent memory exhaustion
- Overflow protection kicks in at 1000 queued logs
CPU Usage
- Console reading happens in a separate thread to avoid blocking
- Async relay ensures Discord API calls don’t block log processing
- ANSI code stripping is optimized with simple string replacement
Discord API Efficiency
- Batching reduces API calls by ~10x
- Dynamic sleep times balance latency and rate limits
- Thread reconnection prevents permanent relay failure
Troubleshooting
No console output appearing
No console output appearing
Possible causes:
- Server not started
- All logs are blacklisted
- Discord thread deleted
- Discord API issues
- Verify server is running
- Check blacklist configuration
- Restart McDis to recreate threads
- Check Discord API status
Console output is delayed
Console output is delayed
Possible causes:
- Discord API rate limiting
- High server log volume
- Network latency
- This is normal during high-traffic periods
- Batching introduces up to 0.5s delay intentionally
- Consider adding more items to blacklist
Some logs are missing
Some logs are missing
Possible causes:
- Queue overflow (>1000 logs)
- Blacklist filtering
- ANSI code interference
- Look for overflow warning in console thread
- Review blacklist configuration
- Check for unusual ANSI codes in server output
Commands sent in thread don't work
Commands sent in thread don't work
Possible causes:
- Server not running
- Wrong console thread
- Typo in command
- Verify process is running
- Ensure you’re in correct console thread
- Try command in actual server console to verify
Best Practices
Use Blacklists Wisely
Filter out spam but keep important warnings and errors visible.
Monitor Queue Overflow
If you see overflow warnings, reduce log verbosity or add to blacklist.
Keep Threads Clean
Archive or delete old messages periodically to improve thread performance.
Test Commands First
Test complex server commands in console thread before automating them.
Advanced: Custom Log Formatting
For advanced users, you can modify log formatting by creating a custom plugin:Related Features
Process Control
Learn how to start and stop servers
Plugins & Addons
Create event-driven automation
Configuration
Configure blacklist and process settings
Discord Panel
Navigate the Discord interface
