ai 开始测试
This commit is contained in:
@@ -123,7 +123,7 @@ class ScriptManager():
|
||||
session = client.session()
|
||||
session.appium_settings({"snapshotMaxDepth": 0})
|
||||
|
||||
if needLike < 3:
|
||||
if needLike < 23:
|
||||
LogManager.method_info("进行点赞", "养号", udid)
|
||||
ControlUtils.clickLike(session, udid)
|
||||
|
||||
@@ -288,6 +288,7 @@ class ScriptManager():
|
||||
|
||||
client = wda.USBClient(udid)
|
||||
session = client.session()
|
||||
|
||||
print(f"是否要自动回复消息:{needReply}")
|
||||
|
||||
LogManager.method_info(f"是否要自动回复消息:{needReply}", "关注打招呼", udid)
|
||||
@@ -426,6 +427,7 @@ class ScriptManager():
|
||||
followButton.click()
|
||||
else:
|
||||
LogManager.method_info("没找到关注按钮", "关注打招呼", udid)
|
||||
time.sleep(1)
|
||||
goBack(3)
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
continue
|
||||
@@ -485,22 +487,25 @@ class ScriptManager():
|
||||
LogManager.method_info("即将要回复消息", "关注打招呼", udid)
|
||||
if needReply:
|
||||
print("如果需要回复主播消息。走此逻辑")
|
||||
if AiUtils.getUnReadMsgCount(session) > 0:
|
||||
|
||||
print("监控回复消息")
|
||||
print("----------------------------------------------------------")
|
||||
|
||||
# 执行回复消息逻辑
|
||||
self.monitorMessages(session, udid)
|
||||
# if AiUtils.getUnReadMsgCount(session) > 0:
|
||||
|
||||
homeButton = AiUtils.findHomeButton(udid)
|
||||
if homeButton.exists:
|
||||
homeButton.click()
|
||||
else:
|
||||
ControlUtils.closeTikTok(session, udid)
|
||||
time.sleep(2)
|
||||
print("监控回复消息")
|
||||
|
||||
ControlUtils.openTikTok(session, udid)
|
||||
time.sleep(3)
|
||||
# 执行回复消息逻辑
|
||||
self.monitorMessages(session, udid)
|
||||
|
||||
homeButton = AiUtils.findHomeButton(udid)
|
||||
if homeButton.exists:
|
||||
homeButton.click()
|
||||
else:
|
||||
ControlUtils.closeTikTok(session, udid)
|
||||
time.sleep(2)
|
||||
|
||||
ControlUtils.openTikTok(session, udid)
|
||||
time.sleep(3)
|
||||
|
||||
print("重新创建wda会话 防止wda会话失效")
|
||||
|
||||
@@ -510,7 +515,7 @@ class ScriptManager():
|
||||
# 执行完成之后。继续点击搜索
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
# 点击搜索按钮
|
||||
ControlUtils.clickSearch(session)
|
||||
# ControlUtils.clickSearch(session)
|
||||
|
||||
else:
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
@@ -641,7 +646,15 @@ class ScriptManager():
|
||||
xml = session.source()
|
||||
msgs = AiUtils.extract_messages_from_xml(xml)
|
||||
# 检测出对方发的最后一条信息
|
||||
last_msg_text = next(item['text'] for item in reversed(msgs) if item['type'] == 'msg')
|
||||
# last_msg_text = next(item['text'] for item in reversed(msgs) if item['type'] == 'msg')
|
||||
|
||||
text_list = ['What do you think of my live stream?',
|
||||
'What do you think makes my streams special?',
|
||||
'Do you think I’m one of the most engaging streamers you’ve seen?']
|
||||
|
||||
last_msg_text = next((item['text'] for item in reversed(msgs) if item['type'] == 'msg'),
|
||||
random.choice(text_list))
|
||||
|
||||
# 向ai发送信息
|
||||
|
||||
# 获取主播的名称
|
||||
|
||||
Reference in New Issue
Block a user