Jev Anti-Spam Bot
A Telegram bot that deletes only the spam Jev is sure about.
# Jev Anti-Spam Bot A minimal [grammY](https://grammy.dev/) Telegram bot that asks TypeSafe's Jev model whether each group message is spam and deletes only high-confidence matches. It targets common Telegram spam: - token, investment, referral, gambling, giveaway, and service shilling; - “check my bio/profile/description” and DM/channel funnels; - phishing, wallet drainers, fake support, and fraudulent airdrops; - unsolicited bot/game promotion, sexual/DM bait, and easy-money pitches; - unsolicited service or product ads that funnel members to DMs, email, or another direct contact; - repetitive, irrelevant, or mass-mention spam. Group administrators, bot senders, and genuine anonymous group administrators (`sender_chat.id` equals the receiving group) are exempt. Channel identities are exempt only when a fresh Telegram `getChat` lookup proves that they are the receiving group’s official `linked_chat_id`. External channel identities are analyzed, even when Telegram supplies a synthetic bot sender or no `from` user. Forwarding alone never establishes an exemption. If Jev or Telegram is unavailable, the bot leaves the message untouched. ## Setup 1. Open `@BotFather`, run `/setprivacy`, select the bot, and choose **Disable**. This is a one-time bot setting required to receive every group message. 2. Set the environment variables: ```sh cp .env.example .env ``` - `TELEGRAM_BOT_TOKEN`: token from BotFather - `TYPESAFE_API_KEY`: TypeSafe API key - `DATABASE_URL` (optional): private PostgreSQL connection URL for chat/deletion statistics 3. Install and run: ```sh bun install bun run check bun start ``` 4. Add the bot to a group as an administrator with **Delete messages** permission. From then on, adding it as an admin is all a group o