147 lines
3.5 KiB
JavaScript
147 lines
3.5 KiB
JavaScript
let lib = require("./lib.js")
|
|
let flowUser = require("./flow_user.js")
|
|
let flowFriend = require("./flow_friend.js")
|
|
let flowChat = require("./flow_chat.js")
|
|
|
|
|
|
|
|
// 获取用户并关注、私信、发送喜欢视频、发送陌生人文本、返回用户主页
|
|
let HuoQuYongHuBingGuanZhuFaSiXin = function () {
|
|
home()
|
|
sleep(200)
|
|
|
|
let checkName = undefined;
|
|
if (lib.store.default_name()) {
|
|
checkName = function (body) {
|
|
let reg = /用户\d+/
|
|
if (body.Nickname.match(reg)) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
}
|
|
|
|
let checkNameKeyword = undefined;
|
|
if (lib.store.name_keyword()) {
|
|
checkNameKeyword = function (body) {
|
|
for (let i = 0; i < lib.store.name_keyword().length; i++) {
|
|
let keyword = lib.store.name_keyword()[i]
|
|
if (body.Nickname.indexOf(keyword) >= 0) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
|
|
let checkAvatar = undefined
|
|
if (lib.store.default_avatar()) {
|
|
checkAvatar = function (body) {
|
|
if (body.Avatar.indexOf("/mosaic-legacy") > 0) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
|
|
if (!flowUser.HuoQuXinYongHu(checkName, checkAvatar, checkNameKeyword)) {
|
|
toastLog("获取新用户失败")
|
|
return false
|
|
}
|
|
|
|
|
|
if (lib.store.produce() && !lib.page.user.hasProduce()) {
|
|
toastLog("用户没有发布作品")
|
|
return true
|
|
}
|
|
|
|
let location = lib.page.user.getIPLocation()
|
|
if (location && lib.store.region().indexOf(location) >= 0) {
|
|
toastLog(`用户地区(${location})不符合`)
|
|
back()
|
|
return true
|
|
}
|
|
|
|
toastLog("准备关注")
|
|
if (!flowUser.GuanZhu()) {
|
|
toastLog("关注失败")
|
|
back()
|
|
return false
|
|
}
|
|
|
|
toastLog("准备私信")
|
|
if (!flowUser.SiXin()) {
|
|
toastLog("私信失败")
|
|
back()
|
|
return
|
|
}
|
|
|
|
toastLog("准备发送喜欢视频")
|
|
if (!flowChat.FaSongXiHuanShiPin()) {
|
|
toastLog("发送喜欢视频失败")
|
|
return
|
|
}
|
|
|
|
toastLog("准备发送陌生人文本")
|
|
if (!flowChat.FaSongMoShengRenWenBen()) {
|
|
toastLog("发送陌生人文本失败")
|
|
return
|
|
}
|
|
back()
|
|
sleep(500)
|
|
|
|
toastLog("返回用户主页")
|
|
if (!flowUser.GoToYongHuZhuYe()) {
|
|
toastLog("返回用户主页 失败")
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
let FaSongHuGuanXiaoXi = function () {
|
|
toastLog("打开用户主页")
|
|
if (!flowUser.GoToYongHuZhuYe()) {
|
|
toastLog("打开用户主页 失败")
|
|
return false
|
|
}
|
|
|
|
toastLog("打开朋友列表")
|
|
if (!flowUser.GoToPengYouLieBiao()) {
|
|
toastLog("打开朋友列表 失败")
|
|
return
|
|
}
|
|
|
|
while (true) {
|
|
toastLog("选择一个好友")
|
|
let name = flowFriend.XuanZeYiGe()
|
|
if (!name) {
|
|
// 好友列表为空,返回上一页
|
|
back()
|
|
break
|
|
}
|
|
|
|
|
|
toastLog("发送私信")
|
|
if (!flowFriend.FaSiXin(name)) {
|
|
toastLog("发送私信失败")
|
|
back()
|
|
continue
|
|
}
|
|
|
|
back()
|
|
sleep(1000)
|
|
while (desc("设置").find().length === 0) {
|
|
log("currentActivity() = ", currentActivity())
|
|
back()
|
|
sleep(1000)
|
|
}
|
|
sleep(1000)
|
|
}
|
|
return true
|
|
}
|
|
|
|
module.exports = {
|
|
HuoQuYongHuBingGuanZhuFaSiXin,
|
|
FaSongHuGuanXiaoXi,
|
|
} |