A telegram Bot that can search for CJK and other languages, as well as message backup utility.
Telegram has bad search experience for CJK languages because those languages are not separated by spacing.
Bug issues were submitted years ago but never fixed.
I'm not planning to be sitting ducks, so I create a bot that can search for CJK languages.
- support text message
- support caption inside photo and document
- support chat username hints
- support import user supplied chat history
- support seamless sync specified chat history in background
- search for one specific user:
/user <username>|<id>|<firstname> keyword
- Telegram allows multiple sessions, maximum is 10 clients.
- We create a hidden session
- We use this session to store all your incoming and outgoing text messages to MongoDB
- We create another bot to search MongoDB
- We return the whole sentence, so you could use Telegram's built-in buggy search feature.
What about history chats before running this bot?
Don't worry, we can either import your history chats, or use config file to sync your history chats.
pagination.mp4
Because chat history is very important, and it should be kept privately, so I don't offer any public bots.
For how to use it in docker, please refer to Docker.md
- Download or clone this repository
- Install Python from here: https://www.python.org/downloads/
- Install MongoDB from here: https://www.mongodb.com/download/
- Apply for APP_ID and APP_HASH from here: https://my.telegram.org/
- Talk to https://t.me/BotFather to get your bot token
- Talk to https://t.me/blog_update_bot to get your user id and your bot's id
Use your favorite editor to modify config.py
, example:
APP_ID = 176552
APP_HASH = "667276jkajhw"
TOKEN = "bottoekn:8hjhad"
MONGO_HOST = "localhost"
OWNER_ID = "2311231"
BOT_ID = "83277"
If your network is limited(like in China), you need to setup proxy.
PROXY = {"scheme": "socks5", "hostname": "localhost", "port": 1080}
Open a terminal(cmd, iTerm, etc), change directory to your code, and then:
python client.py
Input your phone number and login to the client. Ctrl + C to exit
See here
Open two terminals, and respectively:
python client.py
python bot.py
- chat history
- jieba
This project is LICENSED under the GNU GENERAL PUBLIC LICENSE Version 3.