# Link Analyzer Bot - #remora Analyzes links posted in #remora channel in real-time. Fetches content, creates summaries, and adds to Tududi inbox. ## Setup ### 1. Install dependencies ```bash pip install discord.py requests ``` ### 2. Get Discord Bot Token If you don't have a bot token: 1. Go to https://discord.com/developers/applications 2. Click "New Application" 3. Name it "Link Analyzer" (or whatever) 4. Go to "Bot" tab → "Add Bot" 5. Copy the token 6. Under OAuth2 → Scopes, select: `bot` 7. Under Permissions, select: `Read Messages/View Channels`, `Send Messages`, `Read Message History` 8. Go to the generated URL and add bot to your server ### 3. Set environment variables ```bash export DISCORD_BOT_TOKEN="your_token_here" export TUDUDI_API_URL="https://todo.dilain.com/api/v1" export TUDUDI_API_KEY="tt_5e3ac7fc2bf5ae5162ebac5d1d66dcc2ff9d9d0ab343b9d3d4c5a7c439ef67f5" export OPENCLAW_GATEWAY="http://127.0.0.1:18789" export OPENCLAW_GATEWAY_TOKEN="your_gateway_token" ``` ### 4. Run bot ```bash python3 bot.py ``` Should see: ``` āœ… Bot logged in as LinkAnalyzer#1234 šŸ“ Watching channel #remora (1467557082583535729) ``` ## What it does 1. **Real-time monitoring** - Listens to all messages in #remora 2. **Link detection** - Extracts URLs from messages 3. **Content fetching** - Downloads and analyzes page content 4. **Type detection** - GitHub, Reddit, YouTube, TikTok, etc. 5. **Summary response** - Replies with format: `šŸ“Œ **Type**: Title` 6. **Tududi integration** - Adds to inbox: `šŸ“Œ Type: Title\nšŸ”— URL` 7. **History tracking** - Saves to `tracker.json` (all processed links) ## Files - `bot.py` - Main Discord bot - `tracker.json` - History of all processed links - `analyze-links.sh` - Old cron version (deprecated) ## Tracking All links are saved in `tracker.json`: ```json { "links": [ { "url": "https://...", "title": "Article Title", "type": "GitHub", "author": "username", "message_id": 123456, "date": "2026-02-09T18:05:00", "tududi": true } ] } ``` ## Running as service To run permanently (e.g., on a VPS): ```bash # Using screen screen -S link-bot python3 bot.py # Or systemd service # TODO: Add systemd unit file ``` ## Troubleshooting **Bot not seeing messages:** - Check DISCORD_BOT_TOKEN is correct - Verify bot has "Read Message History" permission - Make sure bot is in the server **Can't fetch links:** - Some sites block scrapers → error logged in response - Timeouts after 5 seconds **Tududi not getting items:** - Check TUDUDI_API_KEY is set - Verify API endpoint is reachable ## Future enhancements - [ ] Summarization with AI (use Haiku analysis) - [ ] Tag suggestions based on content - [ ] React with šŸ‘€ when processing - [ ] Edit summary if analysis completes - [ ] Support for media attachments