Maintenance mode activates after current draw completes
- When admin enables maintenance, it's set to 'pending' state - Maintenance activates automatically after the current draw completes - Admin can use immediate=true to force immediate activation - Frontend shows 'Maintenance Scheduled' banner when pending - Telegram bot warns users but still allows purchases when pending - Both mode and pending status tracked in system_settings table
This commit is contained in:
@@ -33,6 +33,26 @@ export async function handleBuyCommand(
|
||||
logUserAction(userId, 'Initiated ticket purchase');
|
||||
|
||||
try {
|
||||
// Check maintenance mode first
|
||||
const maintenance = await apiClient.checkMaintenanceStatus();
|
||||
if (maintenance.enabled) {
|
||||
await bot.sendMessage(
|
||||
chatId,
|
||||
messages.errors.maintenance(maintenance.message || 'System is under maintenance.'),
|
||||
{ parse_mode: 'Markdown' }
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Warn if maintenance is pending (but still allow purchase)
|
||||
if (maintenance.pending) {
|
||||
await bot.sendMessage(
|
||||
chatId,
|
||||
messages.errors.maintenancePending,
|
||||
{ parse_mode: 'Markdown' }
|
||||
);
|
||||
}
|
||||
|
||||
const user = await stateManager.getUser(userId);
|
||||
|
||||
if (!user) {
|
||||
|
||||
Reference in New Issue
Block a user