Overview
Discord Webhook Manager includes AI-powered content generation to help you create engaging Discord messages quickly. The system supports two AI providers:- OpenAI GPT-4 (gpt-4o model)
- Google Gemini (gemini-2.5-flash model)
AI generation is available in all message editors: Quick Send, Webhooks, and Templates.
Configuration
Enable AI Provider
Administrators can configure AI providers through the Settings panel:Provider Configuration
Both providers are configured through theAiService class (app/app/Services/AiService.php:18):
OpenAI Configuration:
- Model:
gpt-4o - Temperature:
0.7 - Max tokens:
1000 - Endpoint:
https://api.openai.com/v1/chat/completions
- Model:
gemini-2.5-flash - Temperature:
0.7 - Max output tokens:
1024 - Endpoint:
https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash:generateContent
User Access Control
Granting AI Access
Administrators control which users can access AI features through the user management panel:- Navigate to Admin Dashboard → Users
- Toggle the AI Access switch for each user
- Set daily usage limits (default: 5 requests per day)
Usage Limits
The system tracks AI usage per user through theai_usages table (app/app/Controllers/AiController.php:26-37):
- Non-admin users have a configurable daily limit (default: 5)
- Usage resets daily at midnight
- Administrators bypass all limits
- Failed generations don’t count toward the limit
Using AI Generation
In Message Editors
The AI generation interface appears in all message composition screens:Prompt Best Practices
The AI uses a specialized system prompt optimized for Discord content:Discord Markdown Support
The AI automatically formats content using Discord markdown:- Bold text:
**text** - Italic text:
*text* Code blocks:`code`- Lists:
- item - Emojis: Native Unicode emojis
API Response Handling
Error Scenarios
The AI controller handles various error cases (app/app/Controllers/AiController.php:14-62):
Permission Denied (403)
Success Response
Usage Tracking
Every successful AI generation is logged in theai_usages table for analytics and quota management.
Database Schema:
- Monitor AI adoption
- Identify power users
- Adjust daily limits as needed
Troubleshooting
API Key Issues
If generation fails, check the logs (storage/logs/laravel.log):
.env file.
Rate Limiting
Both providers have their own rate limits:- OpenAI: Depends on your account tier
- Gemini: Free tier has daily quotas
Model Availability
If a model becomes unavailable:- Check provider status pages
- Update the model name in
AiService.php - Test with the alternative provider
Security Considerations
- API keys are stored in the
settingstable or.env - Keys are never sent to the client
- All AI requests are server-side only
- User prompts are not stored permanently
Next Steps
Automation
Schedule AI-generated messages for automatic delivery
Templates
Save AI-generated content as reusable templates
