A Telegram Bot for searching group chat records by keywords and usernames
Telegram's built-in search supports only whole sentences for languages like CJK, and does not support word segmentation. This project solves the search problem by storing chat records and performing database queries.
- Searching group chat messages by multiple keywords (with pagination)
- Locating message positions
- Command control with restrictions
- Supporting queries across multiple groups (determining whether the user is a group member)
- Supporting username search
- Synchronizing database updates after message edits
Refer to quick-start.md for general installation instructions.
For advanced usage, see advanced-use.md
-
@YourBot @Username keyword1 keyword2... page
Here are some examples:@YourBot
Display all records, defaulting to page 1.@YourBot * 2
Display all message records on page 2.@YourBot weather 3
Search for message records containing the keywordweather
and flips to page 3.@mybot @Taosky weather 4
Search for message records containing the keyword "weather" and the group member "Taosky" (full name) and flips to page 4. -
/help
: Get search help. -
/chat_id
: Get the numerical ID of the current chat.
- Fix message leak to non group members(#65 by JasonKhew96)
- i18n support (en_US,zh_CN)
- Give tips when /start failed (#57)
- Fixed error when importing historical records
- Fixed issue with updating edited messages
- Fixed issue with reading chat IDs when importing historical records
- Fixed potential incorrect message links in userbot mode (#41)
- Python dependency compatibility
- Improved logging
- Added condition to execute corresponding threads only in userbot mode
- Organized directory files
- Modified documentation
- Happy Dragon Boat Festival!
- Added userbot mode
- Refined documentation
- Updated package versions
- Added functionality to search by user
- Attempted to make documentation clearer
more
- Optimized historical records import method
- Resolved memory explosion issue with Python JSON reading
2022-11-23 (#24)
- Some optimizations and refinements
- Built image to ghcr.io (#22)
- Some minor changes, improved configuration and explanations
- Fixed issue with message links not redirecting correctly
2022-10-31 (#21)
- Support for database synchronization after message editing
- Fixed some bugs
2022-10-24 (#19)
- Optimized logic for sending /help in inline mode
- Better permission control
- Changed usage of quotes when referencing messages
- Fixed issue with mismatched Chat IDs when importing historical records
- Fixed issue with duplicate Message IDs
- Fixed error when importing historical records
- Records and searches now support multiple groups (database has changed, historical records need to be reimported)
- User names are now displayed with "@group" to distinguish message sources when searching
- Search results are now filtered based on whether the user is a member of the group
- WebHook mode and docker-compose
- Fixed authentication issue in inline mode
- Fixed error when text is empty
- Web interface for importing historical messages (port 5006)
- Dockerized
- Updated python-telegram-bot library
- Refactored code, simplified operations
- Added support for searching multiple keywords
- Fixed issue with some keyword results not displaying in inline mode (caused by parsing errors with specific characters)
- Added ability to import historical message records. (Only available for initializing the database, and cannot be located)
- Added original message link mode, available for supergroups, allows clicking on links to locate messages
- Added proxy option (Shadowsocks' socks5 seems to be not working, http works)
- Fixed repeated reporting time issue.
- Improved README.
- Fixed pagination issue in searches.
- Rewrote a large amount of code, replaced MYSQL database with SQLITE, used ORM, simplified subsequent development and user configuration.
- Added configuration for excluding IDs
- Added repetition of images, videos, voice messages, and audio
- Added command to obtain database of group members
- Filter robot information during storage
- Bot username no longer needs to be set manually
- Fixed issue where users with no permission under administrator mode could not repeat messages.
MIT © Taosky