https://github.com/raid-guild/undiscord
API endpoint to export Discord channels to HTML
https://github.com/raid-guild/undiscord
Last synced: about 1 year ago
JSON representation
API endpoint to export Discord channels to HTML
- Host: GitHub
- URL: https://github.com/raid-guild/undiscord
- Owner: raid-guild
- License: agpl-3.0
- Created: 2025-03-28T21:13:23.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-18T15:16:56.000Z (about 1 year ago)
- Last Synced: 2025-05-12T06:56:29.415Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 755 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Discord Channel Exporter Service
This service provides an API endpoint that exports Discord channels to HTML using DiscordChatExporter and stores them in DigitalOcean Spaces. It's designed to work with the DungeonMaster bot for RaidGuild's channel archiving workflow.
## Features
- Export Discord channels to HTML using DiscordChatExporter CLI
- Upload exported HTML files to DigitalOcean Spaces for permanent storage
- Move exported channel to a Valhalla (archive) channel category
- RESTful API for triggering exports
- Secure environment variable configuration
- Docker-based deployment
## Prerequisites
- Discord Bot Token with appropriate permissions
- DigitalOcean Spaces account with access keys
- Docker and Docker Compose (for local development)
## Environment Variables
Create a `.env` file with the following variables:
```
VALHALLA_SITE=your_valhalla_site
# Discord Bot Configuration
DISCORD_API_TOKEN=your_discord_bot_token
DISCORD_CLIENT_ID=your_discord_client_id
DISCORD_GUILD_ID=your_guild_id
# Discord Channel IDs
DISCORD_VALHALLA_CATEGORY_ID=your_discord_valhalla_category_id
DISCORD_COMMAND_CENTER_ID=your_discord_command_center_id
# DigitalOcean Spaces Configuration
DO_SPACES_KEY=your_spaces_key
DO_SPACES_SECRET=your_spaces_secret
DO_SPACES_ENDPOINT=https://nyc3.digitaloceanspaces.com
DO_SPACES_BUCKET=your_bucket_name
# Optional: Basic Auth (recommended for production)
API_KEY=your_secure_random_api_key
```
## Local Development Setup
1. Clone the repository:
```
git clone
cd unDiscord
```
2. Create the `.env` file with your environment variables in the project root directory.
3. Build and start the service with Docker Compose:
```
docker-compose up --build
```
4. The service will be available at `http://localhost:8080`.
## API Endpoints
### Health Check
```
GET /health
```
Returns a 200 OK response if the service is running.
### Export Channel
```
POST /export
Content-Type: application/json
X-API-Key: your_api_key
{
"channelId": "your_discord_channel_id",
"guildId": "your_discord_guild_id"
}
```
The `guildId` parameter is optional if you've set the `DISCORD_GUILD_ID` environment variable.
### Response
The export endpoint returns a 202 Accepted response immediately and processes the export asynchronously:
```json
{
"message": "Export started",
"channelId": "your_discord_channel_id",
"guildId": "your_discord_guild_id"
}
```
When the export is complete, the service will move the channel to a Valhalla (archive) channel category.
If the export fails, the channel of the attempted export will be notified.
## Deployment Options
### Using Docker Hub Image
The Discord Channel Exporter is available as a pre-built Docker image:
```bash
docker pull sunsakis/discord-exporter:latest
```
## Troubleshooting
### Common Issues
- **Certificate Errors with DigitalOcean Spaces**: If you see TLS certificate errors, make sure you're using the correct endpoint URL and that the `forcePathStyle` option is enabled in the S3 client configuration.
- **Discord API Rate Limits**: The DiscordChatExporter CLI can hit rate limits if you're exporting large channels or many channels in a short period. Consider adding delays between exports.
- **Permission Errors**: Make sure your Discord bot has the necessary permissions to read the channels you're exporting.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.