{"id":30063965,"url":"https://github.com/zbejas/ad_fontem","last_synced_at":"2026-04-20T03:32:17.414Z","repository":{"id":308710650,"uuid":"1033799335","full_name":"zbejas/ad_fontem","owner":"zbejas","description":"Discord bot that monitors YouTube links and identifies original content sources.","archived":false,"fork":false,"pushed_at":"2026-01-01T18:30:03.000Z","size":86,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-06T17:51:20.644Z","etag":null,"topics":["ai","discord","discord-bot","ollama","sanitization"],"latest_commit_sha":null,"homepage":"https://zbejas.io/projects/ad-fontem/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zbejas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-07T11:10:29.000Z","updated_at":"2026-01-01T18:28:26.000Z","dependencies_parsed_at":"2025-08-07T13:23:41.271Z","dependency_job_id":"f3c4eed7-dfdd-47fe-9f92-afdd8132b09b","html_url":"https://github.com/zbejas/ad_fontem","commit_stats":null,"previous_names":["zbejas/ad_fontem"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zbejas/ad_fontem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbejas%2Fad_fontem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbejas%2Fad_fontem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbejas%2Fad_fontem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbejas%2Fad_fontem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zbejas","download_url":"https://codeload.github.com/zbejas/ad_fontem/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbejas%2Fad_fontem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32031558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","discord","discord-bot","ollama","sanitization"],"created_at":"2025-08-08T04:50:00.177Z","updated_at":"2026-04-20T03:32:17.408Z","avatar_url":"https://github.com/zbejas.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ad Fontem\n\n[![GitHub build status](https://img.shields.io/github/actions/workflow/status/zbejas/ad_fontem/master.yml?label=master%20build)](https://github.com/zbejas/ad_fontem/actions/workflows/master.yml)\n[![GitHub build status](https://img.shields.io/github/actions/workflow/status/zbejas/ad_fontem/dev.yml?label=dev%20build)](https://github.com/zbejas/ad_fontem/actions/workflows/dev.yml)\n[![GitHub last commit](https://img.shields.io/github/last-commit/zbejas/ad_fontem)](https://github.com/zbejas/ad_fontem/commits/master)\n[![GitHub issues](https://img.shields.io/github/issues/zbejas/ad_fontem)](https://github.com/zbejas/ad_fontem/issues)\n[![GitHub pull requests](https://img.shields.io/github/issues-pr/zbejas/ad_fontem)](https://github.com/zbejas/ad_fontem/pulls)\n[![GitHub license](https://img.shields.io/github/license/zbejas/ad_fontem)](https://github.com/zbejas/ad_fontem/blob/master/LICENSE.md)\n[![Release](https://img.shields.io/github/v/release/zbejas/ad_fontem)](https://github.com/zbejas/ad_fontem/releases)\n[![Repo size](https://img.shields.io/github/repo-size/zbejas/ad_fontem)](https://github.com/zbejas/ad_fontem/)\n[![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/zbejas/ad_fontem?sort=date)](https://hub.docker.com/r/zbejas/ad_fontem)\n[![Docker Pulls](https://img.shields.io/docker/pulls/zbejas/ad_fontem)](https://hub.docker.com/r/zbejas/ad_fontem)\n\n**Ad Fontem** _(Latin: \"to the source\")_ is a Discord bot built with Bun and TypeScript that monitors YouTube links and identifies original content sources. It helps combat content theft by automatically finding and sharing the original creators when reaction videos or reposts are detected.\n\nThe bot was created to support original content creators and help communities discover the source material behind reaction videos and reposts. When someone shares a YouTube link, the bot analyzes the video description to find attribution to original content and replies with links to the source material.\n\n\u003e _Also, I quite dislike reaction content as it is recently._\n\n\u003e [!IMPORTANT]\n\u003e This bot respects content creators' rights and focuses on proper attribution. It only identifies content that is explicitly credited in video descriptions, helping to promote original creators.\n\n## ✨ Features\n\n- **🔍 Smart Link Detection**: Automatically detects YouTube URLs in Discord messages across all servers\n- **📝 Description Analysis**: Analyzes video descriptions to find original content attribution\n- **🤖 AI-Powered Fallback**: Optional Ollama LLM integration for complex description parsing when regex patterns fail\n- **⚡ Real-time Processing**: Instant analysis and response to YouTube links\n- **🎯 Accurate Attribution**: Uses _\"sophisticated\"_ regex patterns and AI to identify genuine original content links\n- **📊 Comprehensive Logging**: Winston-based logging with file rotation and debug modes\n- **🐳 Docker Ready**: Fully containerized with Docker Compose support\n- **🔧 Configurable**: Extensive environment variable configuration for different use cases\n\n## 🚀 Installation\n\n### Before You Start\n\nYou'll need to set up a few things before you can run the bot:\n\n- **Discord Bot**: Create a bot on the [Discord Developer Portal](https://discord.com/developers/applications) and get the bot token\n  - Follow the Discord.py guide to create a bot and get the token\n  - Make sure to give the bot the necessary permissions: `bot`\n  - Enable \"Message Content Intent\" in the bot settings\n  - The bot will monitor ALL servers it's added to\n- **YouTube API**: Get a YouTube Data API v3 key from the [Google Cloud Console](https://console.developers.google.com/). Instructions [here](https://developers.google.com/youtube/v3/getting-started).\n- **Optional Ollama**: Set up [Ollama](https://ollama.ai/) for advanced AI-powered content analysis\n\n\u003e [!WARNING]\n\u003e Keep your bot token and API keys secure. Never share them publicly or commit them to version control. If compromised, regenerate them immediately through their respective platforms.\n\n\u003cdetails\u003e\n\u003csummary\u003e🐳 Docker Installation (Recommended)\u003c/summary\u003e\n\nThe easiest way to run Ad Fontem is using Docker Compose. A `compose.yml` file is provided in the repository.\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/zbejas/ad_fontem.git\n   cd ad_fontem\n   ```\n\n2. **Configure environment variables:**\n\n   ```bash\n   cp .env.example .env\n   ```\n\n   Edit the `.env` file with your credentials (see Environment Variables section below).\n\n3. **Start the bot:**\n\n   ```bash\n   docker compose up -d\n   ```\n\nAll application data and logs are stored in the container. You can check available Docker tags on the [Docker Hub page](https://hub.docker.com/r/zbejas/ad_fontem/tags).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e📦 Manual Installation\u003c/summary\u003e\n\nManual installation requires [Bun](https://bun.sh/) to be installed on your system.\n\n1. **Clone and install dependencies:**\n\n   ```bash\n   git clone https://github.com/zbejas/ad_fontem.git\n   cd ad_fontem\n   bun install\n   ```\n\n2. **Configure environment variables:**\n\n   ```bash\n   cp .env.example .env\n   # Edit .env with your configuration\n   ```\n\n3. **Start the bot:**\n\n   ```bash\n   bun run start\n   ```\n\n\u003c/details\u003e\n\n## ⚙️ Environment Variables\n\nThe application uses environment variables that should be defined in a `.env` file (see `.env.example`):\n\n### Required Configuration\n\n| Variable | Description | Example |\n|----------|-------------|---------|\n| `DISCORD_BOT_TOKEN` | Discord bot token from Developer Portal | `abc1234` |\n| `YOUTUBE_API_KEY` | YouTube Data API v3 key from Google Cloud | `cba4321` |\n\n### Optional Configuration\n\n\u003cdetails\u003e\n\u003csummary\u003e⚙️ Expand for more variables\u003c/summary\u003e\n\n| Variable | Description | Default | Example |\n|----------|-------------|---------|---------|\n| `DEBUG` | Enable verbose debug logging | `false` | `true` |\n| `OLLAMA_ENABLED` | Enable Ollama AI analysis | `false` | `true` |\n| `OLLAMA_URL` | Ollama server endpoint | `http://localhost:11434` | `http://ollama.lan:11434` |\n| `OLLAMA_MODEL` | Ollama model to use | `None` | `gemma3:12b` |\n| `OLLAMA_ONLY` | Skip regex, use only AI analysis | `false` | `true` |\n| `OLLAMA_PROMPT` | Custom prompt for AI analysis | _(uses system_prompt.txt if not set)_ | _(custom prompt)_ |\n| `OLLAMA_KEEP_ALIVE` | Ollama connection keep-alive timeout in seconds | `0` | `60` |\n\n\u003c/details\u003e\n\n\u003e [!TIP]\n\u003e The `OLLAMA_ONLY` setting is useful when regex patterns aren't catching complex attribution formats. The AI model can understand natural language attribution better than regex patterns.\n\n## 🔧 How It Works\n\nWhen someone posts a YouTube link in a Discord server where the bot is present:\n\n1. **🔍 Link Detection**: Bot automatically identifies YouTube URLs in messages\n2. **📊 API Fetch**: Retrieves video details and description using YouTube Data API v3\n3. **🧠 Analysis Phase**:\n   - **Standard Mode**: Searches for common attribution patterns using regex (e.g., \"Original:\", \"Credit:\", \"Reacts to:\")\n   - **AI Fallback**: If regex finds nothing and Ollama is enabled, uses LLM for natural language analysis\n   - **AI-Only Mode**: If `OLLAMA_ONLY=true`, skips regex entirely and uses only AI analysis\n4. **✅ Validation**: Verifies found links are valid YouTube URLs\n5. **💬 Response**: Posts original content information with proper attribution\n\n### Attribution Patterns Detected\n\n**Regex Patterns** (Standard Mode):\n\n- Common formats: `Original:`, `Credit:`, `Reacts to:`, `From:`, `Video by:`\n- Followed by YouTube URLs in video descriptions\n\n**AI Analysis** (Fallback or AI-Only Mode):\n\n- Natural language attribution and complex sentence structures\n- Performance depends on model choice and size (larger models = better accuracy)\n\n## 🐛 Troubleshooting\n\n### Common Issues\n\n- **Bot doesn't respond to links**: Check that \"Message Content Intent\" is enabled in Discord Developer Portal\n- **API rate limits**: YouTube API has quotas; consider implementing caching for high-traffic servers\n- **Ollama connection errors**: Ensure Ollama is running and accessible at the configured URL\n- **No original content found**: Bot only finds explicitly credited content in descriptions\n\n### Logs\n\nApplication logs are stored in `logs/app.log` with automatic rotation:\n\n- Maximum file size: 10MB\n- Maximum files: 5\n- Format: `YYYY-MM-DD HH:mm:ss [LEVEL] message`\n\n\u003e [!TIP]\n\u003e Enable debug mode by setting `DEBUG=true` in `.env` for more verbose logging. This can help diagnose issues with link detection and attribution parsing. See all environment variables [above](#⚙️-environment-variables).\n\n---\n\n**Ad Fontem** - _Skip the middleman, find the source._ 😤🎬\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbejas%2Fad_fontem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzbejas%2Fad_fontem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbejas%2Fad_fontem/lists"}