Intelligent keyword search with dual interface: Interactive Telegram bot + Cross-platform desktop GUI, powered by Telegram's search API.
- π€ Telegram Bot - Interactive chat interface with inline keyboards
- π₯οΈ Desktop GUI - Standalone Tkinter application for Windows/Linux/macOS
- π Synchronized - Same core functionality across both interfaces
- π Smart Search - Search for keywords across all your Telegram chats
- π Date Range Filter - Specify start and end dates for targeted searches
- π¬ Chat Selection - Search specific chats/groups or all chats at once
- π€ Multiple Keywords - Search for multiple keywords simultaneously
- π Ranked Results - Messages sorted by relevance with direct links
- πΎ Session Management - Secure session storage and management
- π Per-User Auth - Each user logs in with their own Telegram account
- β‘ Real-Time Processing - Fast keyword search across chat history
- π¨ Modern UI - Clean, intuitive interface
- π± Cross-Platform - Works on all major operating systems
- π Secure - Local session storage with logout capability
πΈ Coming soon - Bot conversation screenshots
πΈ Coming soon - Application screenshots
Try it now: @YourKeywordBot (Coming Soon)
- Python 3.8 or higher
- Telegram API credentials (for both bot and GUI)
- Telegram Bot Token (for bot interface)
- Tkinter (usually included with Python)
# 1. Clone repository
git clone https://github.com/DarkOracle10/-AIkeywordFinderBot.git
cd -AIkeywordFinderBot
# 2. Create virtual environment
python -m venv venv
# Activate (Windows)
venv\Scripts\activate
# Activate (Linux/Mac)
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txtTelegram API Credentials:
- Visit Telegram API
- Log in with your phone number
- Create a new application
- Copy your
api_idandapi_hash
Telegram Bot Token:
- Open Telegram and search for @BotFather
- Send
/newbotand follow instructions - Copy your bot token (format:
1234567890:ABCdefGHIjklMNOpqrsTUVwxyz)
Create .env in project root:
# Telegram API Configuration (Required)
TG_API_ID=your_api_id_here
TG_API_HASH=your_api_hash_here
# Telegram Bot Token (Required for bot interface)
TG_BOT_TOKEN=your_telegram_bot_token_here
# Optional: MTProto Proxy settings
# MT_PROXY_HOST=proxy_host
# MT_PROXY_PORT=proxy_port
# MT_PROXY_SECRET=proxy_secretTelegram Bot:
python run_bot.pyExpected output:
π€ Bot started successfully!
Bot username: @YourKeywordBot
Waiting for messages...
Desktop GUI:
python run_gui.pyBoth simultaneously:
python run_both.pyLegacy bot:
python main.py| Command | Description |
|---|---|
/start |
Initialize bot and show welcome message |
/login |
Log in with your Telegram account |
/logout |
Log out and delete your session |
/status |
Check your login status |
/search |
Search for keywords in your chats |
/help |
Display help and available commands |
/feedback |
Send feedback to the admin |
/cancel |
Cancel current operation |
Initial Setup:
You: /start
Bot: π Welcome to AI Keyword Finder Bot!
Available commands:
/login - Login with your account
/search - Search for keywords
/help - Get help
You: /login
Bot: π± Please enter your phone number in international format
Example: +1234567890
You: +1234567890
Bot: β
Code sent! Please enter the verification code:
You: 12345
Bot: β
Logged in successfully!
Searching:
You: /search
Bot: Which chats would you like to search?
(Enter chat names separated by commas, or type 'all')
You: all
Bot: Enter keywords to search (comma-separated):
Example: python,django,remote
You: artificial intelligence, machine learning
Bot: π
Enter start date (YYYY-MM-DD):
You: 2024-01-01
Bot: π
Enter end date (YYYY-MM-DD):
You: 2024-12-31
Bot: π Searching... Please wait.
Bot: β
Found 15 messages:
1. Chat: Tech Discussion
"Artificial intelligence is transforming..."
π [View Message](https://t.me/c/123456/789)
2. Chat: ML Study Group
"Machine learning algorithms have..."
π [View Message](https://t.me/c/234567/890)
...
python run_gui.py- Enter phone number in international format
- Enter verification code sent to your Telegram
- Enter 2FA password (if enabled)
- Chat Selection: Choose specific chats or "All Chats"
- Keywords: Enter comma-separated keywords
- Date Range: Set start and end dates
- Click "Search" button
- Results displayed in scrollable list
- Click message links to open in Telegram
- View message preview and chat information
- Sessions persist between application restarts
- Use "Logout" button to clear session
-AIkeywordFinderBot/
βββ main.py # Legacy bot entry point
βββ run_bot.py # Telegram bot launcher
βββ run_gui.py # Desktop GUI launcher
βββ run_both.py # Combined launcher
βββ config.py # Shared configuration
βββ utils.py # Shared utility functions
βββ searcher.py # Message search functionality
βββ session_manager.py # Per-user session management
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ README.md # This file
βββ bot_pkg/ # Telegram bot package
β βββ __init__.py
β βββ main_bot.py # Bot logic and handlers
βββ desktop_app/ # Desktop GUI package
β βββ __init__.py
β βββ main_gui.py # Tkinter GUI application
β βββ auth.py # Desktop authentication
βββ standalone-app/ # Standalone app resources
βββ sessions/ # User session files (git ignored)
βββ docs/ # Documentation
β βββ SCREENSHOTS.md # Screenshot guide
βββ telegram_search.spec # PyInstaller build spec
Main interface with login and search functionality
Configuration options for search parameters
Search results with clickable message links
Modify in code or set via GUI:
SEARCH_PARAMS = {
'max_results': 20, # Maximum results to display
'include_channels': True, # Include channels in search
'include_groups': True, # Include groups in search
'include_private': True, # Include private chats
'exclude_saved': True, # Exclude "Saved Messages"
'exclude_bots': True, # Exclude bot chats
}SESSION_CONFIG = {
'session_dir': 'sessions/', # Session storage directory
'timeout': 3600, # Session timeout (seconds)
'auto_logout': False, # Auto logout on exit
}# Install PyInstaller
pip install pyinstaller
# Build executable
pyinstaller telegram_search.spec
# Output: dist/TelegramSearch.exe# Install dependencies
pip install pyinstaller
# Build
pyinstaller --onefile run_gui.py
# Output: dist/run_gui# Install py2app
pip install py2app
# Create setup.py
python setup.py py2app
# Output: dist/KeywordFinder.app- Session Storage: User sessions are stored locally in
sessions/directory - Token Security: Sessions contain authentication tokens - keep secure
- User Privacy: Bot owner cannot access user messages
- Logout: Users can delete sessions anytime with
/logout - Git Ignore:
sessions/is excluded from version control
.env file or sessions/ directory to version control
Bot not responding:
- β
Verify bot token is correct in
.env - β Check internet connection
- β
Ensure bot is started:
python run_bot.py
GUI won't launch:
- β Install Tkinter: Usually included with Python
- β Check Python version (3.8+ required)
- β
Verify dependencies:
pip install -r requirements.txt
"Your session expired":
- β Session is no longer valid
- β
Solution:
/logoutthen/loginagain
"Invalid phone format":
- β Use international format with +
- β
Example:
+1234567890(not1234567890)
API errors:
- β
Verify API credentials in
.env - β Check API limits/quotas
- β Ensure API credentials are valid
2FA Issues:
- β Enter 2FA password exactly as configured
- β Bot will prompt if 2FA is enabled
# Run tests (if available)
pytest tests/
# Test bot functionality
python -m pytest tests/test_bot.py
# Test GUI components
python -m pytest tests/test_gui.pyDeploy to cloud platform:
Railway.app:
railway login
railway init
railway upHeroku:
heroku create keyword-bot
git push heroku mainDocker:
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "run_bot.py"]Contributions welcome! Areas for improvement:
- Add more search filters
- Implement message export
- Add multi-language UI
- Batch processing
- Advanced search operators
- Visualization charts
- Browser extension
MIT License - See LICENSE file
Amir Aeiny
- GitHub: @DarkOracle10
- Telegram: @YourUsername
- Email: amir.aeiny10@gmail.com
β Star this repo if you find it useful!
π± Try the bot: @YourKeywordBot