'',
'requester_name' => '',
'query_text' => '',
'source_type' => 'search',
'voice_channel' => '',
'notes' => '',
];
if ($_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['action'] ?? '') === 'create_request') {
$values['guild_name'] = trim((string)($_POST['guild_name'] ?? ''));
$values['requester_name'] = trim((string)($_POST['requester_name'] ?? ''));
$values['query_text'] = trim((string)($_POST['query_text'] ?? ''));
$values['source_type'] = trim((string)($_POST['source_type'] ?? 'search'));
$values['voice_channel'] = trim((string)($_POST['voice_channel'] ?? ''));
$values['notes'] = trim((string)($_POST['notes'] ?? ''));
if ($values['guild_name'] === '') {
$formErrors[] = 'Server/Guild name is required.';
}
if ($values['requester_name'] === '') {
$formErrors[] = 'Requester name is required.';
}
if ($values['query_text'] === '') {
$formErrors[] = 'Song title or URL is required.';
}
if (!in_array($values['source_type'], ['search', 'url'], true)) {
$formErrors[] = 'Source type is invalid.';
}
if (!$formErrors) {
$stmt = db()->prepare('INSERT INTO music_requests (guild_name, requester_name, query_text, source_type, voice_channel, notes, status) VALUES (:guild_name, :requester_name, :query_text, :source_type, :voice_channel, :notes, :status)');
$stmt->execute([
':guild_name' => $values['guild_name'],
':requester_name' => $values['requester_name'],
':query_text' => $values['query_text'],
':source_type' => $values['source_type'],
':voice_channel' => $values['voice_channel'],
':notes' => $values['notes'],
':status' => 'queued',
]);
$newId = (int)db()->lastInsertId();
header('Location: request.php?id=' . $newId . '&created=1');
exit;
}
}
$recentRequests = db()->query('SELECT id, guild_name, requester_name, query_text, source_type, status, created_at FROM music_requests ORDER BY created_at DESC LIMIT 6')->fetchAll();
$recentLogs = db()->query('SELECT user_name, action, created_at FROM bot_logs ORDER BY created_at DESC LIMIT 5')->fetchAll();
if (!$recentLogs) {
add_log('System', 'INITIALIZE', 'CMS Dashboard initialized successfully.');
add_log('Admin', 'CONFIG_UPDATE', 'Bot settings updated (prefix and volume).');
$recentLogs = db()->query('SELECT user_name, action, created_at FROM bot_logs ORDER BY created_at DESC LIMIT 5')->fetchAll();
}
// Check if worker is running
$workerPid = shell_exec("pgrep -f 'bot/worker.php'");
$isWorkerRunning = !empty($workerPid);
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
$projectName = $_SERVER['PROJECT_NAME'] ?? 'Discord Music Bot Control Center';
?>
= h($projectName) ?>
Stable Discord music operations
Manage play requests, queue health, and bot settings in one restrained console.
Submit a song by URL or search query, track status per server, and keep moderation settings consistent across communities.
Bot status
Auto-reconnect
= $settings['auto_reconnect'] ? 'Enabled' : 'Disabled' ?>
Command prefix
= h($settings['prefix']) ?>
Max volume
= h((string)$settings['max_volume']) ?>%
Log level
= h($settings['log_level']) ?>
Worker Status
= $isWorkerRunning ? 'Always-on' : 'Stopped' ?>
Discord link
= $settings['discord_token'] ? 'Connected' : 'Missing token' ?>
Adjust settings
Recent queue activity
Latest submissions across all servers.
No requests yet.
Submit the first play request to start the queue.
Open full queue
Recent audit logs
Security and operational events.
= h($log['action']) ?>
= h($log['created_at']) ?>
by = h($log['user_name']) ?>
View all logs
Slash command coverage
/play
/search
/queue
/skip
/pause
/resume
/stop
/loop
/shuffle
/volume
/nowplaying
Commands map to the request queue and playback service.