20250904-初步功能已完成

This commit is contained in:
2025-09-08 21:42:09 +08:00
parent 31f0e19b13
commit 4b3247d0bf
8 changed files with 692 additions and 177 deletions

View File

@@ -284,6 +284,8 @@ class ScriptManager():
time.sleep(3)
LogManager.method_error("greetNewFollowers 重试次数耗尽,任务终止", "关注打招呼", udid)
# 关注打招呼以及回复主播消息
def greetNewFollowers(self, udid, needReply, event):
@@ -319,12 +321,15 @@ class ScriptManager():
print("总循环条件", not event.is_set() and len(anchorList) > 0)
# 循环条件。1、 循环关闭 2、 数据处理完毕
while not event.is_set() and len(anchorList) > 0:
while not event.is_set():
# 获取一个主播,并删除
anchor = anchorList.pop(0)
aid = anchor.anchorId
anchorCountry = anchor.country
anchor = AiUtils.pop_aclist_first()
if not anchor:
break
aid = anchor["anchorId"]
anchorCountry = anchor.get("country", "")
# 点击搜索按钮
ControlUtils.clickSearch(session)
@@ -462,10 +467,13 @@ class ScriptManager():
LogManager.method_info("找到输入框了, 准备发送一条打招呼消息", "关注打招呼", udid)
print("打招呼的数据", ev.prologueList)
LogManager.method_info(f"打招呼的数据:{ev.prologueList}", "关注打招呼", udid)
# 准备打招呼的文案
text = random.choice(ev.prologueList)
LogManager.method_info(f"打招呼完成", "关注打招呼", udid)
isContainChniese = AiUtils.contains_chinese(text)
if isContainChniese:
@@ -473,6 +481,8 @@ class ScriptManager():
msg = Requester.translation(text, anchorCountry)
else:
msg = text
LogManager.method_info(f"翻译后的私信数据:{msg}", "关注打招呼", udid)
# 准备发送一条信息
chatInput.click()
@@ -660,9 +670,15 @@ class ScriptManager():
'What do you think makes my streams special?',
'Do you think Im one of the most engaging streamers youve seen?']
last_msg_text = next((item['text'] for item in reversed(msgs) if item['type'] == 'msg'),
last_msg = next((item['text'] for item in reversed(msgs) if item['type'] == 'msg'),
random.choice(text_list))
isLanguage = AiUtils.is_language(last_msg)
if isLanguage:
last_msg_text = last_msg
else:
last_msg_text = random.choice(text_list)
# 向ai发送信息
# 获取主播的名称