关闭自动通过申请

This commit is contained in:
zihanjian
2025-10-13 11:48:11 +08:00
parent faafbfaa13
commit 9d36c63f47
4 changed files with 13 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ Bubbles 是一个功能丰富的微信机器人框架,基于 [wcferry](https:/
- 处理各类微信消息(文本、图片、小程序、链接等)
#### 🔧 实用工具
- 自动接受好友请求并打招呼
- 自动接受好友请求并打招呼(可通过 `auto_accept_friend_request` 配置开启)
- 自动响应群聊和私聊消息
## 🛠️ 安装指南

View File

@@ -148,3 +148,5 @@ perplexity: # -----perplexity配置这行不填-----
ai_router: # -----AI路由器配置-----
enable: true # 是否启用AI路由功能
allowed_groups: [] # 允许使用AI路由的群聊ID列表例如["123456789@chatroom", "123456789@chatroom"]
auto_accept_friend_request: false # 是否自动通过好友申请,默认关闭

View File

@@ -41,5 +41,6 @@ class Config(object):
self.GEMINI_IMAGE = yconfig.get("gemini_image", {})
self.GEMINI = yconfig.get("gemini", {})
self.AI_ROUTER = yconfig.get("ai_router", {"enable": True, "allowed_groups": []})
self.AUTO_ACCEPT_FRIEND_REQUEST = yconfig.get("auto_accept_friend_request", False)
self.MAX_HISTORY = yconfig.get("MAX_HISTORY", 300)
self.SEND_RATE_LIMIT = yconfig.get("send_rate_limit", 0)

View File

@@ -310,7 +310,11 @@ class Robot(Job):
if not handled:
# 7.1 好友请求自动处理
if msg.type == 37: # 好友请求
self.autoAcceptFriendRequest(msg)
if getattr(self.config, "AUTO_ACCEPT_FRIEND_REQUEST", False):
self.LOG.info("检测到好友请求,自动通过开关已启用,准备同意。")
self.autoAcceptFriendRequest(msg)
else:
self.LOG.info("检测到好友请求,自动通过开关已关闭,保持待处理状态。")
return
# 7.2 系统消息处理
@@ -457,7 +461,10 @@ class Robot(Job):
if nickName:
# 添加了好友,更新好友列表
self.allContacts[msg.sender] = nickName[0]
self.sendTextMsg(f"Hi {nickName[0]},我是泡泡,我自动通过了你的好友请求。", msg.sender)
greeting = f"Hi {nickName[0]},我是泡泡,很高兴认识你。"
if getattr(self.config, "AUTO_ACCEPT_FRIEND_REQUEST", False):
greeting = f"Hi {nickName[0]},我是泡泡,我自动通过了你的好友请求。"
self.sendTextMsg(greeting, msg.sender)
def newsReport(self) -> None:
receivers = self.config.NEWS