20250904-初步功能已完成

This commit is contained in:
2025-09-05 19:16:14 +08:00
parent 11057f8ce6
commit 31f0e19b13
5 changed files with 66 additions and 85 deletions

View File

@@ -8,8 +8,9 @@ import os
from Utils.AiUtils import AiUtils
from Utils.ControlUtils import ControlUtils
from Utils.LogManager import LogManager
from Entity.Variables import anchorList, removeModelFromAnchorList, prologueList, anchorWithSession
from Entity.Variables import anchorList, removeModelFromAnchorList, anchorWithSession
from Utils.Requester import Requester
import Entity.Variables as ev
# 脚本管理类
@@ -313,6 +314,10 @@ class ScriptManager():
ControlUtils.clickBack(session)
time.sleep(2)
print("循环条件1", not event.is_set())
print("循环条件2", len(anchorList) > 0)
print("总循环条件", not event.is_set() and len(anchorList) > 0)
# 循环条件。1、 循环关闭 2、 数据处理完毕
while not event.is_set() and len(anchorList) > 0:
@@ -452,12 +457,23 @@ class ScriptManager():
# 查找聊天界面中的输入框节点
chatInput = session.xpath("//TextView")
if chatInput.exists:
print("找到输入框了, 准备发送一条打招呼消息")
LogManager.method_info("找到输入框了, 准备发送一条打招呼消息", "关注打招呼", udid)
print("打招呼的数据", ev.prologueList)
# 准备打招呼的文案
text = random.choice(prologueList)
# 翻译成主播国家的语言
msg = Requester.translation(text, anchorCountry)
text = random.choice(ev.prologueList)
isContainChniese = AiUtils.contains_chinese(text)
if isContainChniese:
# 翻译成主播国家的语言
msg = Requester.translation(text, anchorCountry)
else:
msg = text
# 准备发送一条信息
chatInput.click()
time.sleep(2)
@@ -487,8 +503,6 @@ class ScriptManager():
print("即将要回复消息")
LogManager.method_info("即将要回复消息", "关注打招呼", udid)
if needReply:
print("如果需要回复主播消息。走此逻辑")
@@ -497,7 +511,6 @@ class ScriptManager():
# 执行回复消息逻辑
self.monitorMessages(session, udid)
homeButton = AiUtils.findHomeButton(udid)
if homeButton.exists:
homeButton.click()