Telegram Anti-Spam Bot: Dynamic Question Generator

In the previous episode, we implemented the basic framework of an anti-spam bot What if we want to implement a rich way of generating question-answer pairs? Let's look at the current code. After generating a question-answer pair, it's saved, and then new members answer the question and the answer is checked. So, let's do this. In the directory where the python file main.py is located, there is a pset directory.  The pset directory contains multiple .py files.  Each of these .py files contains at least 1 function: buildQA buildQA returns 2 strings, one is the question, and one is the correct_answer I want to randomly call the buildQA function from one of the .py files in the pset directory in main.py Throw this text at M$ copilot (or any GPT you have on hand), and you'll easily get an answer. Apply the modification plan to the project. In the main py file, add this function def get_random_module():     # Find all .py files in the pset directory (excluding __init__.py)   ...

电报防广告机器人 telegram antispam bot 重构产生问题和回答的方式

上一期我们实现了防广告机器人的基本框架 如果我们想实现丰富的 问题-答案 生成方式, 怎么做呢? 看一下目前的代码. 是生成了 问题-答案 后, 保存起来, 然后新成员再回答问题, 并检查答案.

Telegram Anti-Spam Bot with Text-Based CAPTCHA

用了这么久的telegram, 看到的防广告机器人, 都是用选按钮的方式回答问题, 理论上有被穷举题库的可能性. 如果你的群足够有吸引力, 想加群的广告机器人足够多, 总是可以找到入群问题的答案的. 而入群问题如果太变态 ( https://github.com/XTLS/Xray-core/discussions/3487 ) 反而拒绝了一些能力不强的正常人类 (TA们本身并不是想发广告, 只是想入群提问或交流) 所以我有了一个思路, 如果这个人机检查的问题需要回答文本呢? 用干就干, 利用claude进行初步构建. 我要开发这样的一个telegram机器人 机器人在群组中工作 当机器人检测到有新成员加入时, 机器人将新成员设置禁言. 机器人要求新成员在与机器人的私聊过程中完成人机检测. 如果通过人机检测, 那么机器人解除新成员的禁言状态. 人机检测的具体过程是这样的 当新成员向机器人发送/start时, 机器人提问, 新成员输入文本回答. 得到的结果放到 VS Code, 和 M$ Copilot 合作, 进行调试. 效果 Github https://github.com/crazypeace/tg-join-group-exam-bot/ 总代表量(算上空行和注释)不到300行, 是不是很轻量! * 考虑到后续还会有几期更新. 所以本期的代码也复制了一份  tg-join-group-exam-bot1.py 在项目里. 部署方法见项目 readme 目前这只是一个最基础的架子, 后续我们再慢慢优化. 欢迎关注我的博客 https://zelikk.blogspot.com/p/icdyct.html ======== 相关推荐 《电报防广告机器人 telegram antispam bot 我的博客最新一期博文的标题是什么 html解析 rss xml解析》 《电报防广告机器人 telegram antispam bot 在群内发言时需要人机验证》 《面向GPT开发实例集合》

电报防广告机器人 telegram antispam bot 新成员入群时需要人机验证 用回复文本的方式增加发广告的成本

用了这么久的telegram, 看到的防广告机器人, 都是用选按钮的方式回答问题, 理论上有被穷举题库的可能性. 如果你的群足够有吸引力, 想加群的广告机器人足够多, 总是可以找到入群问题的答案的. 而入群问题如果太变态 ( https://github.com/XTLS/Xray-core/discussions/3487 ) 反而拒绝了一些能力不强的正常人类 (TA们本身并不是想发广告, 只是想入群提问或交流) 所以我有了一个思路, 如果这个人机检查的问题需要回答文本呢?

Monetizing Telegram Keyword Monitor Bot: 5 Strategies

Continuing from the previous post Today I'll continue talking about some thoughts on commercializing the Telegram keyword monitor bot. That is, how you can use the project to make money. Github https://github.com/crazypeace/tg-keyword-monitor-bot Let's review the architecture of this project again Sell the labor of setting up the project For the user of the project, it would be inconvenient to still need to operate a Linux system and modify configuration files to change keywords. This project provides a way to modify keywords by sending commands to the bot, so users don't need to touch the Linux environment. Example, Client A provides a TG account as the collector, and has already joined all the information source groups. You set up this project, and set Client A's TG account as both the administrator and consumer. The usage is, If they need to monitor more groups, Client A operates the TG account themselves to join groups. If they need to modify keywords, Client A oper...

商业化电报关键词提醒机器人 telegram keyword monitor bot

书接上文 今天接着说商业化电报关键词提醒机器人 telegram keyword monitor bot 的一些思考. 也就是, 你可以怎样用项目去卖钱. Github https://github.com/crazypeace/tg-keyword-monitor-bot 再复习一下本项目的架构 卖的是搭建项目的劳动 对于项目的使用者来说, 如果还要操作linux系统, 修改配置文件来修改关键字, 使用起来会不方便. 本项目提供向机器人发命令来修改关键字的操作方式, 使用者不需要接触linux环境. 示例, 甲方 提供 tg账号, 作为采集者, 把信息源的群都加好. 你把这个项目搭起来, 把甲方的tg账号设置为 管理员 和 消费者. 使用方式就是, 如果要监听更多的群, 甲方自己操作tg账号去加群. 如果要修改关键字, 甲方自己操作tg账号和机器人交互修改关键字. 甲方在tg账号上接收机器人发送的关键字消息. 卖的是信息源 比如, 某些群 加群要收费, 或者不接收新群成员了.  而你手里有已经加了这些群的tg账号, 作为 采集者. 示例,  在同一个大圈子里, 不同的甲方有不同的关键字需求. 你的采集者是同一个tg账号. 你为每一个甲方, 分别 运行一个项目. (可以共用VPS, python环境. 建不同的目录就行了) 其它设置都和标准流程一样, 只是设置同样的 采集者 (配置文件中的 user_phone 参数) 卖消费者权限 如果这个行业关注的关键字相当同质化, 你也掌握了信息源. 想降低维护成本, 你可以直接卖消费者权限. 示例, 你可以直接修改配置文件的 result_id_list 列表, 添加不同的 接收关键字消息的 tg 账号的ID. 你也可以把一个tg频道的id 设置为 result_id_list. 然后把 发布者的 bot 添加为频道的管理员, 这样就可以发关键字通知了. 你可以把频道设置为私有的, 你控制订阅这个频道的权限就行. 你收了钱, 再把某个tg用户添加进频道. 我自己公开了一个关键字消息的频道示例: https://t.me/FuckGFWNewbieNeedHelp 使用多个采集者 不希望一个tg账号加太多的群, 担心一下子被封号的风险. 或者是你已经触达500个群组的上限. 运行多套程序, 分别使用不同的采集...

Telegram Keyword Alert Bot Setup Guide

Recently, I developed a Telegram keyword alert bot uploaded to Github https://github.com/crazypeace/tg-keyword-monitor-bot This article describes the setup process. First, you can take a look at the readme of the Github project, which is a step-by-step illustrated tutorial in operating order from start to finish. If you find that tutorial a bit confusing, then below, I'll describe it from a different angle. System Architecture Information Source -> Collector -> This Program -> Publisher -> Consumer Components of the System Information Source is the various tg groups and channels you want to monitor Collector is a tg account   * It is recommended that you register a new tg account to play with. This Program is the main.py of this project   * This program requires api_id and api_hash. You need to apply for them at  https://my.telegram.org/apps . You need to log in to a tg account here, which can be the same account as the collector, or a different account.  Publisher is a...

搭建电报关键词提醒机器人 telegram keyword monitor bot

前几天 开发了一个电报关键词提醒机器人 已上传Github https://github.com/crazypeace/tg-keyword-monitor-bot 本文描述搭建过程. 首先, 你可以看看Github项目的readme, 那是一个从头到尾按操作顺序手把手的图文教程. 如果你觉得那篇教程有点云里雾里, 那么下面, 我换一个角度来描述. 系统架构 信息源 -> 采集者 -> 本程序 -> 发布者 -> 消费者 系统中的各部分 信息源 是 你想监听的各个tg群组, 频道 采集者 是 一个tg账户   * 推荐你注册一个新tg账户来玩. 本程序 是 本项目 main.py   * 本程序需要 api_id, api_hash. 需要到  https://my.telegram.org/apps 申请. 这里需要登录tg账户, 可以是 采集者同账户, 也可以是不同的账户.  发布者 是 一个tg机器人   * 本程序需要 bot_token, 需要向  https://t.me/BotFather 申请. 向 @BotFather 发起机器人申请的tg账户, 可以和前面同账户, 也可以是不同的账户. 消费者 是 接收关键字通知消息 的用户或群组或频道 本项目的运行环境 安装python 一般你用的比较新版本的操作系统 Debian / Ubuntu, 已经自带了.  略 安装 pip apt install -y python3-pip 拉取项目 apt install -y git git clone https://github.com/crazypeace/tg-keyword-monitor-bot cd tg-keyword-monitor-bot 安装python依赖 pip3 install -r requirements.txt --break-system-packages config.yaml.default 复制为 config.yaml 系统中各部分之间的关系 信息源 与 采集者 之间的关系 你自己登录 采集者账户 的身份, 加入信息源. 入群验证, 不公开群需要别人拉你, 需要管理员审批, ... 等等等等 这些问题, 需要你自己解决. ...

Lightweight Telegram Keyword Alert Bot for Personal Use

Preface I previously used a Telegram keyword alert bot project . After using it, I felt the functionality was a bit heavy. The original project was designed for multi-user use, where different users follow different keywords and different groups. Therefore, the original project required a database. I plan to develop a lightweight Telegram keyword alert bot suitable for personal use. I'll write the code with the help of the powerful GPT. The first version of the code was generated using the free Claude. Subsequent code debugging was done using the free M$ Copilot. Designed Features The bot only accepts control commands from users or groups with specified IDs,  After the bot detects a keyword, it sends a notification message to the user, group, or channel with the specified ID, The list of followed keywords supports regular expressions The list of excluded keywords supports regular expressions Both the list of followed keywords and the list of excluded keywords are updated and saved ...