forked from CameronJGrant/telegram-scam-baiter
570b15c5a49e3b261db04607573c874e1c2d01a1
#telegram-scam-baiter Telethon + OpenAI bot that engages unsolicited DMs with safe, time-wasting small talk. It uses a focused system prompt, keeps recent chat history, and replies with human-like delays to keep scammers busy while revealing nothing useful. ## What it does - Listens for messages from a single target (by username or numeric user ID), or auto-targets the first inbound DM. - Maintains a rolling history and crafts short, question-ending replies to keep the other person typing. ## Environment variables | Variable | Required | Default | Description | |-----------------------|----------|-----------------------|-----------------------------------------------------------------------------| | TG_API_ID | yes | — | Telegram API ID from https://my.telegram.org | | TG_API_HASH | yes | — | Telegram API hash from https://my.telegram.org | | TG_SESSION | no | telethon_session | Session file prefix used by Telethon | | TARGET_USERNAME | no | — | Target's public username (without @). Leave empty if using TARGET_USER_ID | | TARGET_USER_ID | no | 0 | Target's numeric Telegram user ID (use if no username) | | OPENAI_API_KEY | yes | — | OpenAI API key | | OPENAI_MODEL | no | gpt-4o-mini | Chat-capable model used for replies | | MIN_DELAY_SEC | no | 25 | Minimum delay (seconds) before each reply | | MAX_DELAY_SEC | no | 75 | Maximum delay (seconds) before each reply | | HISTORY_FILE | no | chat_history.jsonl | Path to local JSONL file for conversation history | | MAX_TOKENS_HISTORY | no | 2200 | Rough token budget for messages passed to the model | | MAX_MESSAGES_HISTORY | no | 30 | Hard cap on number of messages kept in rolling history | | PYTHONUNBUFFERED | no | 1 | If set, forces unbuffered output in some environments | Notes: - Set either TARGET_USERNAME or TARGET_USER_ID. If neither is set, the first inbound DM will become the target automatically. - Increase delays if you hit Telegram flood limits. ## License MIT License — see LICENSE file for details.
Languages
Python
87.7%
Smarty
7.4%
Shell
2.5%
Dockerfile
2.4%