Overview
Scheduled Messages allow you to automate Discord communication by scheduling messages for future delivery. The system supports:- One-time messages: Send once at a specific date and time
- Recurring messages: Repeat daily, weekly, or monthly
- File attachments: Include images and videos (up to 10MB)
- Timezone support: Schedule in your local timezone
- Pause/resume: Control recurring message execution
Scheduled messages are processed every minute by Laravel’s scheduler and executed by queue workers.
Architecture
The automation system uses multiple Laravel components:Creating Scheduled Messages
One-Time Messages
Schedule a message to send once at a specific date and time:Configure Message Content
Compose your message using the visual editor:
- Text content (max 2000 characters)
- Up to 10 embeds with full customization
- Optional template loading
app/app/Controllers/ScheduledMessageController.php:68-137
Recurring Messages
Create messages that repeat on a schedule:Setting Send Limits
Control how many times a recurring message will be sent:max_sends null for unlimited recurring messages.
File Attachments
Upload Process
Files are stored temporarily during scheduling (app/app/Controllers/ScheduledMessageController.php:120-133):
storage/app/scheduled_messages/{message_id}/
Auto-Deletion
This happens in theSendScheduledMessage job after Discord confirms receipt.
Storage Path: Files are stored using Laravel’s local disk:
Managing Scheduled Messages
View All Messages
The index page shows all your scheduled messages with filters:- Status: Pending, Completed, Failed, Paused
- Type: One-time, Recurring
- Pagination: 20 messages per page
app/app/Controllers/ScheduledMessageController.php:17-42
Pause and Resume
Control recurring message execution: Pause a Message (app/app/Models/ScheduledMessage.php:179-184):
app/app/Models/ScheduledMessage.php:186-195):
One-time messages cannot be paused since they execute once and complete.
Edit Scheduled Messages
You can edit scheduled messages only if they haven’t been sent yet (app/app/Controllers/ScheduledMessageController.php:172-175):
- Webhook selection
- Message content
- Schedule time/pattern
- Timezone
- Max sends limit
- File attachments
Delete Messages
Deleting a scheduled message:- Removes the database record
- Deletes all associated files via observer
- Cannot be undone
app/app/Controllers/ScheduledMessageController.php:252-261
Timezone Handling
The system converts all schedules to UTC for storage (app/app/Controllers/ScheduledMessageController.php:85-88):
America/New_York, Europe/Paris, Asia/Tokyo)
Message States
Scheduled messages progress through several states:| State | Description | Next Actions |
|---|---|---|
| pending | Waiting to be sent | Automatically processes when next_send_at arrives |
| processing | Currently being sent | Transitions to completed or failed |
| completed | Successfully sent (one-time) or reached max_sends | No further action |
| failed | Delivery failed | Check error_message field, can be deleted |
| paused | Manually paused (recurring only) | Can be resumed |
app/app/Models/ScheduledMessage.php:145-169 (markAsSent method)
Recurrence Calculation
The system calculates next send times based on frequency (app/app/Models/ScheduledMessage.php:88-143):
Daily:
Integration with Templates
Load saved templates when creating scheduled messages:message_content. This ensures the scheduled message remains unchanged even if the template is modified later.
Code Reference: app/app/Controllers/ScheduledMessageController.php:109
Worker Configuration
Supervisor Configuration
Cron Configuration
Add to your crontab:Monitoring and Debugging
Check Queue Status
View Failed Jobs
Retry Failed Jobs
Logs Location
Scheduled message processing logs appear in:storage/logs/laravel.log- General application logsstorage/logs/worker.log- Queue worker output (if using Supervisor)
Troubleshooting
Messages Not Sending
File Upload Issues
Problem: Files not attaching to messages Solutions:- Verify file size is under 10MB
- Check file format is supported
- Ensure
storage/app/scheduled_messages/is writable - Review
upload_max_filesizeandpost_max_sizeinphp.ini
Timezone Confusion
Problem: Messages sending at wrong times Solutions:- Verify timezone setting matches your location
- Check server timezone:
datecommand - Confirm timezone in
.env:APP_TIMEZONE=Europe/Madrid - Ensure database stores UTC timestamps
Best Practices
Test First
Create one-time messages in the near future to verify configuration before setting up recurring messages.
Set Max Sends
For recurring messages, always set
max_sends to prevent infinite loops during testing.Monitor Storage
If using many file attachments, monitor storage usage even though files auto-delete.
Use Templates
Save frequently used messages as templates for quick scheduling.
Next Steps
Message History
View delivery history and analytics
AI Generation
Generate message content automatically
