Image by imagen-3 on ImageFX, prompt "an icon for telegram group message summarize and search message bot sketchy"
Feel scared when seeing 2000+ unread in groups? Now you can read them by LLM!
Use d1, cf worker, ai gateway, gemini-2.0-flash.
bot: https://github.com/codebam/cf-workers-telegram-bot
d1: https://developers.cloudflare.com/d1/get-started/
ai gateway: https://developers.cloudflare.com/ai-gateway/
check wiki
/summary 10
summarize newest 10 messages
/summary 10h
summarize newest 10h messages
/query word
can search cjk
/ask question
answer question based on group chat
/status
check bot is alive
0
d1: telegram bot can't read info in the history, only newly sent info, so use database to keep them. pricing
cf worker: so no more offline.(I hope so) pricing
gemini-2.0-flash: free for limited usage and huge context
For openAI or others,use the getGenModel
from openai.ts
, fill in the keys, it returns Promise<string>
so remember to await
The Newest 4000 text messages will be kept, images will be kept for 2 days. May change in the future.
add method to import group history information so history info can be searched.
maybe auto-delte query result
TODO:
maybe word cloud?
This bot will store chat history into my d1 database, so deploy your own bot is recommended. Unless I am in your group.
Only messages sent by user and after the bot join the group can be summarized/query.
Why doesn't my bot see messages from other bots? Bots talking to each other could potentially get stuck in unwelcome loops. To avoid this, we decided that bots will not be able to see messages from other bots regardless of mode.
https://core.telegram.org/bots/faq#why-doesn-39t-my-bot-see-messages-from-other-bots
You can't get older message than bot join.
If you want to bypass these, check luoxu, which uses userbot.