Telegram Keyword Monitor Bot with Sticker Reply

Requirement

Want to run an experiment 
When the keyword 三色图 is detected, send a sticker

Underlying Tech


Preparation

Pick an alt account that won't interfere with your normal usage to send stickers

Apply for api_id and api_hash

Get the api_id and api_hash

Approach

To avoid interfering with the existing keyword bot,
we'll have this alt account follow the channel that the keyword bot outputs to,
and when the channel reports that someone posted "三色图" in a group, this alt account will send a sticker in that same group.

Developing with GPT

There's already such a channel
that publishes keyword-monitoring messages like this

#FOUND (https://t.me/c/1958152252/300436) "自建" IN Joey Huang Blog(1958152252) FROM jacky jay(5979280761)
自建的节点怎么不能访问X和chatgpt啊

It might also look like this

#FOUND (https://t.me/LoonCommunity/161393) "大佬" IN Loon Community(@LoonCommunity) FROM Yang Bo(@Zen_Neng_Bu_Bian_Tai)
大佬们,loon怎么在不开梯子的情况下去除广告啊?

Need to develop a Telegram bot
that, when "三色图" appears in the monitoring channel, sends a sticker in the source group.
The sticker is the 1st sticker from https://t.me/addstickers/fuckgfwnewbie

Upload to GitHub


Demo Video


Deployment


========

Postscript

This time (2025-11-07), for GPT-driven development, the GPT used was

The GPT-generated program had a BUG; it grabbed the message's plain text
message_text = event.message.message
The correct approach is to extract the message's markdown text
from telethon.extensions import markdown
message_text = markdown.unparse(event.message.message, event.message.entities)



Comments