Telegram Keyword Bot: Send Sticker via Direct Message
Preface
What about sending a direct message to the user directly?
Requirement
When the keyword naive is detected, send the sticker via direct message
Technical Foundation
GPT-Oriented Development
Based on the above code, enhance the development with the following feature:
When "naive " appears in the monitored channel, send a sticker to the user via private message.
The sticker is the 2nd sticker from https://t.me/addstickers/fuckgfwnewbie
Noticed that the notification messages in the monitoring channel have a format.
#FOUND (https://t.me/c/1958152252/300436) "self-built" IN Joey Huang Blog(1958152252) FROM jacky jay(5979280761)
Why can't the self-built node access X and ChatGPT?
#FOUND (https://t.me/LoonCommunity/161393) "boss" IN Loon Community(@LoonCommunity) FROM Yang Bo(@Zen_Neng_Bu_Bian_Tai)
Bosses, how do I remove ads in Loon without turning on the proxy?
The format of the first line of the communication message is #FOUND (source information) "matching keyword" IN xxx (group username or userid) FROM yyy (user username or userid)
Upload to Github
Demo Video
Deployment
========
Postscript
This time (2025-11-09) for GPT-oriented development, the GPT used is
The program generated by GPT has a BUG, getting the plain text of the message
message_text = event.message.message
The correct approach is to extract the markdown text of the message
from telethon.extensions import markdown message_text = markdown.unparse(event.message.message, event.message.entities)
