2.8 KiB
2.8 KiB
Discord Sync Integration
This document explains how to set up the Discord OAuth integration between your Flutter app and Discord bot.
Overview
The integration allows users to:
- Log in with their Discord account
- Sync conversations between the Flutter app and Discord bot
- Import conversations from Discord to the Flutter app
- Export conversations from the Flutter app to Discord
Setup Instructions
1. Discord Developer Portal Setup
- Go to the Discord Developer Portal
- Click "New Application" and give it a name (e.g., "OpenRouter GUI")
- Go to the "OAuth2" section
- Add a redirect URL:
openroutergui://auth
- Copy the "Client ID" - you'll need this for the Flutter app
2. Flutter App Setup
-
Open
lib/services/discord_oauth_service.dart
-
Replace
YOUR_DISCORD_CLIENT_ID
with the Client ID from the Discord Developer Portal:static const String clientId = 'YOUR_DISCORD_CLIENT_ID';
-
Open
lib/services/sync_service.dart
-
Replace
YOUR_BOT_API_URL
with the production API URL:static const String botApiUrl = 'https://slipstreamm.dev/discordapi';
3. SSL Certificates
- SSL certificates are required for the production API
- Place your SSL certificates in the following locations:
certs/cert.pem # SSL certificate file certs/key.pem # SSL key file
- The API will automatically use SSL if certificates are available
- For development, the API will fall back to HTTP on port 8000 if certificates are not found
Bot Commands
The following commands are available for managing synced conversations:
!aisync
- View your synced conversations status!syncstatus
- Check the status of the Discord sync API!synchelp
- Get help with setting up the Discord sync integration!syncclear
- Clear your synced conversations!synclist
- List your synced conversations
Usage
- In the Flutter app, go to Settings > Discord Integration
- Click "Login with Discord" to authenticate
- Use the "Sync Conversations" button to sync conversations
- Use the "Import from Discord" button to import conversations from Discord
Troubleshooting
- Authentication Issues: Make sure the Client ID is correct and the redirect URL is properly configured
- Sync Issues: Check that the bot API URL is accessible and the API is running
- Import/Export Issues: Verify that the Discord bot has saved conversations to sync
Security Considerations
- The integration uses Discord OAuth for authentication, ensuring only authorized users can access their conversations
- All API requests require a valid Discord token
- The API verifies the token with Discord for each request
- Consider adding rate limiting and additional security measures for production use