From 91b7ec2b67d74e4d2e41c857232414feb3cb7bfd Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 02 四月 2025 18:32:10 +0800
Subject: [PATCH] 功能完善

---
 comment_manager.py |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/comment_manager.py b/comment_manager.py
index 4c72cd4..66040da 100644
--- a/comment_manager.py
+++ b/comment_manager.py
@@ -3,6 +3,8 @@
 """
 # 淇濆瓨鍥炲瑙嗛璇勮鐨勭敤鎴锋樀绉�
 # {"瑙嗛鍚嶇О+鍙戝竷鏃ユ湡":{"璇勮鐢ㄦ埛鐨勬樀绉�":{"璇勮鍐呭闆嗗悎"}}}
+import re
+
 import comment_util
 
 __reply_video_comment_user_name_dict = {}
@@ -24,15 +26,16 @@
     __reply_video_comment_user_name_dict[k][comment_nick_name].add(comment_content)
 
 
-def get_replay_content(video_name, video_date, comment_nick_name, comment_content):
+def get_replay_content(video_info, comment_nick_name, comment_content):
     """
     鑾峰彇鍥炲鍐呭
-    :param video_name:瑙嗛鍚嶇О
-    :param video_date:瑙嗛鏃ユ湡
+    :param video_info:(瑙嗛鍚嶇О, 鏃ユ湡, 璇勮娆℃暟, 瑙嗛鏍囬)
     :param comment_nick_name:璇勮鏄电О
     :param comment_content:璇勮鍐呭
     :return:
     """
+    video_name, video_date, video_title = video_info[0], video_info[1], video_info[3]
+
     k = f"{video_name}{video_date}"
     if k not in __reply_video_comment_user_name_dict:
         __reply_video_comment_user_name_dict[k] = {}
@@ -51,7 +54,13 @@
     comment_content = comment_util.replace_img_with_alt(comment_content)
 
     for r in comment_templates:
-        if r.match(r[0], comment_content):
+        is_match = False
+        if r[0].find("銆愯棰戞爣棰樸��") >= 0:
+            if comment_content.find(video_title)>=0:
+                is_match = True
+        elif re.match(r[0], comment_content):
+            is_match = True
+        if is_match:
             # 鑳藉鍖归厤鍒版鍒欒〃杈惧紡
             result = comment_util.load_content(r[1], comment_nick_name, comment_content)
             if result:
@@ -75,7 +84,7 @@
     # 鏇挎崲璇勮鍐呭涓殑img
     comment_content = comment_util.replace_img_with_alt(comment_content)
     for r in like_conditions:
-        if r.match(r, comment_content):
+        if re.match(r, comment_content):
             # 鑳藉鍖归厤鍒版鍒欒〃杈惧紡
             return True
     return False

--
Gitblit v1.8.0