2025-09-26 10:15:55 -07:00
2025-09-26 10:15:55 -07:00
2025-09-26 10:15:55 -07:00
2025-09-26 10:15:55 -07:00
2025-09-26 10:15:55 -07:00
2025-09-26 10:15:55 -07:00

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#telegram-scam-baiter

Telethon + OpenAI bot that engages unsolicited DMs with safe, timewasting small talk. It uses a focused system prompt, keeps recent chat history, and replies with humanlike 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 autotargets the first inbound DM.
- Maintains a rolling history and crafts short, questionending 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.
Description
No description provided
Readme MIT 140 KiB
Languages
Python 87.7%
Smarty 7.4%
Shell 2.5%
Dockerfile 2.4%