From ddcfcf21fe82d120c2082120d5b9d1c63a9ffee5 Mon Sep 17 00:00:00 2001 From: Saboteur7 Date: Thu, 23 Nov 2023 22:05:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=A4=E8=81=8A=E5=8F=AA=E6=9C=89=E8=89=BE?= =?UTF-8?q?=E7=89=B9=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=89=8D=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel/feishu/feishu_channel.py | 8 ++++---- config.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/channel/feishu/feishu_channel.py b/channel/feishu/feishu_channel.py index aed9436..5e7e4fc 100644 --- a/channel/feishu/feishu_channel.py +++ b/channel/feishu/feishu_channel.py @@ -6,9 +6,6 @@ """ # -*- coding=utf-8 -*- -import io -import os -import time import uuid import requests @@ -188,9 +185,12 @@ class FeishuController: is_group = False chat_type = msg.get("chat_type") if chat_type == "group": - if not msg.get("mentions"): + if not msg.get("mentions") and msg.get("message_type") == "text": # 群聊中未@不响应 return self.SUCCESS_MSG + if msg.get("mentions")[0].get("name") != conf().get("feishu_bot_name") and msg.get("message_type") == "text": + # 不是@机器人,不响应 + return self.SUCCESS_MSG # 群聊 is_group = True receive_id_type = "chat_id" diff --git a/config.py b/config.py index fd6bb93..3b6d130 100644 --- a/config.py +++ b/config.py @@ -118,9 +118,10 @@ available_setting = { # 飞书配置 "feishu_port": 80, # 飞书bot监听端口 - "feishu_app_id": "", - "feishu_app_secret": "", - "feishu_token": "", + "feishu_app_id": "", # 飞书机器人应用APP Id + "feishu_app_secret": "", # 飞书机器人APP secret + "feishu_token": "", # 飞书 verification token + "feishu_bot_name": "", # 飞书机器人的名字 # chatgpt指令自定义触发词 "clear_memory_commands": ["#清除记忆"], # 重置会话指令,必须以#开头