A local Telegram bot for receiving anonymous messages through a personal link.
Each owner gets a link in the following format:
https://t.me/<bot_username>?start=<token>
Another user opens the link, sends a message, and the bot delivers it to the owner. The owner receives the message from the bot and cannot see the sender's Telegram profile.
- a personal link for each user;
- persistent storage of links and sessions in SQLite;
- disabling and regenerating personal links;
- support for text, photos, videos, voice messages, video notes, audio files, documents, GIFs, animations, and stickers;
- support for contacts, locations, venues, polls, and dice emojis;
- message length limit of 2000 characters;
- message rate limiting;
- handling of invalid and disabled links;
- owner replies through Telegram Reply on anonymous messages;
- replies can contain text or any supported media type.
- Python 3.12 or newer;
- a Telegram bot created through @BotFather.
Create a virtual environment and install the dependencies:
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txtCreate a .env file in the project root:
BOT_TOKEN=token_from_BotFatherpython main.pyThe bot uses long polling. The qna.sqlite3 database is created automatically on the first launch.
| Command | Action |
|---|---|
/start |
Show the active personal link or create one |
/link |
Create a new personal link |
/disable |
Disable all active links |
/enable |
Create a new active link |
/cancel |
Clear the currently selected message recipient |
/help |
Show help |
A full test requires two Telegram accounts:
- Open the bot with the first account and send
/start. - Copy the generated link.
- Open the link with the second account.
- Send a text message.
- Make sure the message is delivered to the link owner from the bot.
- Reply to the received message using Telegram Reply.
- Make sure the reply is delivered to the sender without exposing the sender's profile to the owner.
- media albums are delivered as separate messages;
- Telegram system messages and unsupported entities are not forwarded;
- a local SQLite database is used.
- The bot technically receives the Telegram IDs of both the sender and the owner, so complete anonymity from Telegram, the server owner, and the developer cannot be guaranteed.
qna.sqlite3stores the sender, the owner, the question content, and its delivery history. This allows the server owner to reconstruct the connection between users.- To support Reply, the bot temporarily stores a link between the owner's notification message and the original sender. This temporary mapping is deleted after the reply is successfully delivered, but the main question record remains in SQLite.
- The text and content of the owner's reply are not stored separately in SQLite, although Telegram and server logs may temporarily contain them.
- The owner may be able to indirectly identify the sender based on writing style, message content, timing, and the sequence of replies.
- Telegram can see the participants and messages passing through the bot.
- Access to the server, database file, or logs may expose senders, owners, and message history.
- Replies are sent on behalf of the bot, but Telegram may show the sender that the response is a Reply to their original message.
Локальный Telegram-бот для приема анонимных текстовых сообщений по персональной ссылке.
Владелец получает ссылку вида:
https://t.me/<bot_username>?start=<token>
Другой пользователь открывает ссылку, пишет сообщение, а бот доставляет его владельцу. Владелец видит сообщение от имени бота и не видит Telegram-профиль отправителя.
- персональная ссылка для каждого пользователя;
- постоянное хранение ссылок и сессий в SQLite;
- отключение и перевыпуск ссылок;
- прием текста, фото, видео, голосовых, кружков, аудио, файлов, GIF, анимаций и стикеров;
- прием контактов, геолокаций, мест, опросов и эмодзи-кубиков;
- ограничение сообщения до 2000 символов;
- ограничение частоты отправки сообщений;
- обработка невалидных и отключенных ссылок.
- ответы владельца через Reply на анонимное сообщение;
- поддержка ответов текстом и всеми поддерживаемыми типами медиа.
- Python 3.12 или новее;
- Telegram-бот, созданный через @BotFather.
Создай виртуальное окружение и установи зависимости:
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txtСоздай файл .env в корне проекта:
BOT_TOKEN=токен_от_BotFatherpython main.pyБот работает через long polling. База данных qna.sqlite3 создается автоматически при первом запуске.
| Команда | Действие |
|---|---|
/start |
Показать активную персональную ссылку или создать её |
/link |
Создать новую персональную ссылку |
/disable |
Отключить все активные ссылки |
/enable |
Создать новую активную ссылку |
/cancel |
Сбросить выбранного получателя сообщения |
/help |
Показать справку |
Для полноценной проверки нужны два Telegram-аккаунта:
- На первом аккаунте открыть бота и отправить
/start. - Скопировать полученную ссылку.
- На втором аккаунте открыть эту ссылку.
- Отправить текстовое сообщение.
- Убедиться, что первое сообщение пришло владельцу ссылки от имени бота.
- Ответить на полученное сообщение через Reply.
- Убедиться, что ответ пришёл отправителю без раскрытия его профиля владельцу.
- альбомы доставляются отдельными сообщениями;
- системные сообщения Telegram и неподдерживаемые сущности не пересылаются;
- используется локальный SQLite;
- Бот технически получает Telegram ID отправителя и владельца, поэтому полная анонимность от Telegram, владельца сервера и разработчика не гарантируется.
- В
qna.sqlite3сохраняются отправитель, владелец, содержимое вопроса и история его доставки. Это позволяет владельцу сервера восстановить связь между людьми. - Для Reply временно сохраняется связь между сообщением-уведомлением владельца и исходным отправителем. После успешной доставки ответа эта временная связь удаляется, но основная запись вопроса остаётся в SQLite.
- Текст и содержимое ответа владельца отдельно в SQLite не сохраняются, но Telegram и серверные логи могут их временно содержать.
- Владелец может косвенно установить личность отправителя по стилю, содержанию, времени и последовательности ответов.
- Telegram видит участников и сообщения, проходящие через бота.
- Доступ к серверу, файлу базы данных или логам может раскрыть отправителей, владельцев и переписку.
- Ответы отправляются от имени бота, но Telegram может показать отправителю, что ответ является Reply на его исходное сообщение.