primer commit

This commit is contained in:
Ichitux
2026-04-07 16:41:13 +02:00
commit 3289a7275a
3743 changed files with 761346 additions and 0 deletions

91
README.md Normal file
View File

@@ -0,0 +1,91 @@
# Discord RSS Bot
A Discord bot that reads messages from a channel, stores them in SQLite, and serves them as an RSS feed.
## Setup
### 1. Create a Discord Bot
1. Go to [Discord Developer Portal](https://discord.com/developers/applications)
2. Click "New Application" and give it a name
3. Go to the "Bot" section and click "Add Bot"
4. Copy the bot token
5. Under "Privileged Gateway Intents", enable:
- Server Members Intent
- Message Content Intent
6. Go to "OAuth2" > "URL Generator"
7. Select scopes: `bot`
8. Select bot permissions: `Read Messages/View Channels`, `Send Messages`
9. Use the generated URL to invite the bot to your server
### 2. Configure Environment
```bash
cp .env.example .env
```
Edit `.env` and add:
- `DISCORD_TOKEN` - Your bot token
- `DISCORD_CHANNEL_ID` - The channel ID to monitor (enable Developer Mode in Discord to copy channel IDs)
### 3. Install Dependencies
```bash
npm install
```
### 4. Run
```bash
npm start
```
## Usage
### RSS Feed
Access the RSS feed at:
```
http://localhost:3000/rss/{channel_id}
```
Or with a custom limit:
```
http://localhost:3000/rss/{channel_id}?limit=20
```
### List Available Channels
```
GET http://localhost:3000/rss/
```
### Manually Trigger Fetch
```
POST http://localhost:3000/fetch/{channel_id}
```
## API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/rss` | List all channels with messages |
| GET | `/rss/:channelId` | Get RSS feed for a channel |
| GET | `/rss/:channelId?limit=N` | Get RSS feed with N messages |
| POST | `/fetch/:channelId` | Trigger message fetch |
| GET | `/health` | Health check |
## Configuration
| Variable | Default | Description |
|----------|---------|-------------|
| `DISCORD_TOKEN` | - | Discord bot token |
| `DISCORD_CHANNEL_ID` | - | Channel to monitor |
| `PORT` | 3000 | Server port |
| `BASE_URL` | http://localhost:3000 | Base URL for RSS links |
| `FETCH_INTERVAL_MS` | 300000 | Auto-fetch interval (5 min) |
## Database
Messages are stored in `data/messages.db` (SQLite). The database is created automatically on first run.