SnapAnsAI Bot is a tool for instant answers based on screenshots. The user presses a hotkey, and the screenshot is automatically sent to a Telegram bot, which analyzes the image using OpenAI API and returns a text response.
β
Hotkeys β automatic screenshot capture (multiple combinations can be set in config.json
).
β
Automatic image sending to the Telegram bot.
β
AI Selection β support for OpenAI for image processing.
β
Flexible settings in config.json
(change API, hotkeys, OS, etc.).
β
Cross-platform: Windows, Linux, macOS (auto-detection of OS).
β
Logging in bot.log
for easy debugging (all errors and events are recorded in the log).
β
Multilingual support β the bot supports language switching via config.json
and adding new languages in lang.json
.
π Education: Screenshots of tasks and instant explanations.
π Work: Capturing important on-screen data and quick analysis.
π§« Research: Extracting text from charts and documents.
π¬ Communication: Processing text and images in real time.
π Daily use: Quickly obtaining text from any screen.
π Proctoring: ?
π Python β main programming language.
π€ Telegram Bot API β interaction with the bot.
π§ OpenAI API β image and text processing.
π₯οΈ PyAutoGUI β screenshot capture (Windows).
π§ gnome-screenshot β screenshot capture (Ubuntu).
π screencapture β screenshot capture (macOS).
β¨οΈ pynput β hotkey handler.
π Requests β interaction with APIs.
π Logging β logging system.
flameshot
β a screenshot tool
SnapAnsAI Bot consists of several components:
π System Components:
1οΈβ£ Telegram Bot β receives AI-processed messages from the bot.
2οΈβ£ AI Processing Module β sends images to OpenAI or DeepSeek and retrieves a response.
3οΈβ£ Screenshot Capture Module β operates via PyAutoGUI, gnome-screenshot
, flameshot
, or screencapture
.
4οΈβ£ Logging Module β records all events and errors in bot.log
.
5οΈβ£ Configuration Module β loads and manages config.json
.
snapansai-bot/
βββ config/ # Configuration files
β βββ config.json # Configuration file
β βββ lang.json # Translation file for multilingual support
βββ logs/ # Logs
β βββ session_temp/ # Temporary files (screenshots and cache)
β βββ bot.log # Bot log file
βββ methods/ # Screenshot processing modules
β βββ flameshot.py # Screenshot handler via flameshot
βββ src/ # Project source code
β βββ ai_api.py # AI API handler
β βββ bot.py # Main Telegram bot
β βββ config_handler.py # Configuration management (loading, saving)
β βββ screenshot_sender.py # Screenshot sending script
βββ test/ # AI testing scripts
β βββ test_ai.py # Project launch script
βββ venv/ # Virtual environment
βββ README.md # Project documentation
βββ requirements.txt # Dependencies file
βββ start.sh # Project launch script
πΉ System Startup:
- The bot starts with
start.sh
. - Initializes the Telegram Bot API token.
- Initializes the Chat ID.
- Initializes the AI API Key.
- Detects the user's OS (Windows/Linux/macOS).
- Loads configuration from
config.json
. - Launches the hotkey handler.
- Waits for a hotkey press (
alt+s
,ctrl+m
, etc.).
πΉ Screenshot Processing:
- When a hotkey is pressed, a screenshot is taken and saved in the temporary folder
logs/session_temp/
. - The image is sent to the AI server for analysis.
- The received text response is sent to the Telegram bot.
- The screenshot is deleted from the temporary folder.
πΉ Using flameshot
:
- If
flameshot
is used, the save path can be set in the configuration. - To disable pop-up notifications about saving, run:
flameshot config
and uncheck Show desktop notifications
in the General tab.
bash start.sh
During installation, you will need to provide the API key for the Telegram bot and AI. After installation, you can press the hotkeys, and screenshots will be processed by AI and sent to the Telegram bot.
In config.json
, you can edit:
"bot_token": ""
- Telegram Bot API token"chat_id": 0
- Telegram Chat ID (auto-detection)"language": ""
- Language (available: en, ru, de)"api_key": ""
- AI API key (available: OpenAI, DeepSeek)"model": ""
- AI model (OpenAI: gpt-4o-mini, gpt-4o, o3-mini, gpt-4.5-preview, etc.)"hotkey": ""
- Hotkeys (you can specify one or more, e.g.,"hotkey": "alt+s, ctrl+m, p, /"
)"os": ""
- OS (auto-detection)"method":
- Default is "default" β built-in OS screenshot managers are used. Available:"flameshot"
.
In lang.json
, you can edit:
"prompt": ""
- Prompt- Add other languages
β
Improved hotkey processing
β
Integration with OpenAI
β
Tested on Ubuntu 24.04 (Wayland)
β
Flexible configuration via config.json
β
Added flameshot
as an alternative method
π Testing on Windows, MacOS
π Adding Docker
π Integration with other AI models (DeepSeek, Claude, Gemini, etc.)
- USDT (TRC20)/USDC (TRC20):
TUQj3sguQjmKFJEMotyb3kERVgnfvhzG7o
- SOL (Solana):
6VA9oJbkszteTZJbH6mmLioKTSq4r4E3N1bsoPaxQgr4
- XRP (XRP):
rDkEZehHFqSjiGdBHsseR64fCcRXuJbgfr
β¨ Designed for convenience and quick access to answers.