今天分享一个音麦,音柚,探遇漂流瓶自动打招呼回复源码。代码是用Auto.js开发的,可以自动打招呼,回复。可在上面二次开发。
"ui";
var myapp = {}
myapp.ppdelayMin = "10" //匹配延时最小值
myapp.ppdelayMax = "15" //匹配延时最大值
myapp.delayMin = "3" //捡瓶子延时最小值
myapp.delayMax = "5" //捡瓶子延时最大值
myapp.jpzfrequency = "5" //窃语匹配次数
myapp.dmppnumber = "5" //逗萌匹配次数
myapp.dmjpznumber = "5" //逗萌捡瓶子次数
myapp.xmppnumber = "5" //星梦匹配次数
myapp.xmjpznumber = "5" //星梦捡瓶子次数
myapp.syppnumber = "5" //随缘广场匹配次数
myapp.syjpznumber = "5" //随缘扔瓶子次数
myapp.syrpznumber = "5" //随缘捡瓶子次数
myapp.xialasy = "3"
var 捡瓶子路径 = "/sdcard/捡瓶子话术.txt"
var 扔瓶子路径 = "/sdcard/扔瓶子话术.txt"
var 匹配话术路径 = "/sdcard/话术库.txt"
var 话术路径 = "/sdcard/话术.txt"
var 瓶子话术组, 话术组, 匹配话术组, 扔瓶子话术组
var rjbh = "1"; //软件编号
var sjb, 验证结果, 时间
myapp.存储标识 = "MIKE1990"
ui.layout(<ScrollView ><vertical><appbar><toolbar id="toolbar" title="智能机器人" /></appbar><card w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical"><vertical padding="18 8" h="auto"><linear><Switch id="autoService" text="无障碍服务:" checked="{{auto.service != null}}" w="auto" textStyle="bold" /><Switch id="overlayService" text="悬浮窗权限" checked="{{auto.service != null}}" padding="8 8 8 8" textSize="15sp" marginLeft="20" /></linear></vertical><View bg="#E51400" h="*" w="5" /></card><card w="*" h="auto" margin="10 5" cardCornerRadius="2dp"cardElevation="1dp" gravity="center_vertical"><vertical padding="18 8" h="auto"><linear><text text="激活码:" textcolor="black" w="auto" /><input id="SDKl" inputType="number" text="" w="*" inputType="text" /></linear></vertical><View bg="#ff5722" h="*" w="5" /></card><card w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical"><vertical padding="18 8" h="auto"><linear><text text="平台任务选择:" textColor="black" w="auto" /><spinner id="mainMenu" entries="随缘漂流瓶|星梦漂流瓶|窃语漂流瓶|逗萌漂流瓶" spinnerMode="dialog" /></linear></vertical><View bg="#ff5722" h="*" w="5" /></card><card w="*" h="auto" margin="10 5" cardCornerRadius="2dp"cardElevation="1dp" gravity="center_vertical"><vertical padding="18 8" h="auto"><linear><text text="随缘漂流瓶功能设置:" textcolor="black" w="auto" /></linear><linear><text text="广场匹配次数:" textcolor="black" w="auto" /><input id="syppnumber" inputType="number" text="" w="50" /><text text="次" textcolor="black" w="auto" /></linear><linear><text text="捡瓶子次数:" textcolor="black" w="auto" /><input id="syrpznumber" inputType="number" text="" w="50" /><text text="次" textcolor="black" w="auto" /></linear><linear><text text="扔瓶子次数:" textcolor="black" w="auto" /><input id="syjpznumber" inputType="number" text="" w="50" /><text text="次" textcolor="black" w="auto" /></linear></vertical><View bg="#ff5722" h="*" w="5" /></card><card w="*" h="auto" margin="10 5" cardCornerRadius="2dp"cardElevation="1dp" gravity="center_vertical"><vertical padding="18 8" h="auto"><linear><text text="星梦漂流瓶功能设置:" textcolor="black" w="auto" /></linear><linear><text text="星梦匹配次数:" textcolor="black" w="auto" /><input id="xmppnumber" inputType="number" text="" w="50" /><text text="次" textcolor="black" w="auto" /></linear><linear><text text="捡瓶子次数:" textcolor="black" w="auto" /><input id="xmjpznumber" inputType="number" text="" w="50" /><text text="次" textcolor="black" w="auto" /></linear></vertical><View bg="#ff5722" h="*" w="5" /></card><card w="*" h="auto" margin="10 5" cardCornerRadius="2dp"cardElevation="1dp" gravity="center_vertical"><vertical padding="18 8" h="auto"><linear><text text="窃语漂流瓶功能设置:" textcolor="black" w="auto" /></linear><linear><text text="捡瓶子次数:" textcolor="black" w="auto" /><input id="jpzfrequency" inputType="number" text="" w="50" /><text text="次" textcolor="black" w="auto" /></linear></vertical><View bg="#ff5722" h="*" w="5" /></card><card w="*" h="auto" margin="10 5" cardCornerRadius="2dp"cardElevation="1dp" gravity="center_vertical"><vertical padding="18 8" h="auto"><linear><text text="逗萌漂流瓶功能设置:" textcolor="black" w="auto" /></linear><linear><text text="逗萌匹配次数:" textcolor="black" w="auto" /><input id="dmppnumber" inputType="number" text="" w="50" /><text text="次" textcolor="black" w="auto" /></linear><linear><text text="捡瓶子次数:" textcolor="black" w="auto" /><input id="dmjpznumber" inputType="number" text="" w="50" /><text text="次" textcolor="black" w="auto" /></linear></vertical><View bg="#ff5722" h="*" w="5" /></card><card w="*" h="auto" margin="10 5" cardCornerRadius="2dp"cardElevation="1dp" gravity="center_vertical"><vertical padding="18 8" h="auto"><linear><text text="全局功能设置:" textcolor="black" w="auto" /></linear><linear><text text="每次捡瓶子或匹配间隔" textcolor="black" w="auto" /><input id="delayMin" inputType="number" text="" w="40" /><text text="秒至" textcolor="black" w="auto" /><input id="delayMax" inputType="number" text="" w="40" /><text text="秒" textcolor="black" w="auto" /></linear><linear><text text="回复完成间隔" textcolor="black" w="auto" /><input id="ppdelayMin" inputType="number" text="" w="40" /><text text="秒至" textcolor="black" w="auto" /><input id="ppdelayMax" inputType="number" text="" w="40" /><text text="秒继续任务" textcolor="black" w="auto" /></linear></vertical><View bg="#ff5722" h="*" w="5" /></card><text text="注意事项:" w="*" h="auto" textSize="12sp" textColor="red" margin="15 5" /><text text="启动应用前先开启无障碍服务,否则机器人不会运行,如果无障碍无法开启或无法启动请重启手机后重试,注意需要安卓7.0系统以上版本才能运行 !" w="*" h="auto" textSize="12sp" textColor="#ff5722" margin="15 5" /><button style="Widget.AppCompat.Button.Colored" margin="5" id="start">开始执行</button></vertical></ScrollView>
);读取界面配置(true)
//开关的单击事件
ui.autoService.on("check", function (checked) {// 用户勾选无障碍服务的选项时,跳转到页面让用户去开启if (checked && auto.service == null) {app.startActivity({action: "android.settings.ACCESSIBILITY_SETTINGS"});}if (!checked && auto.service != null) {auto.service.disableSelf();}
});ui.overlayService.on("check", function (checked) {// 用户勾选无障碍服务的选项时,跳转到页面让用户去开启if (checked) {try {int = app.startActivity({packageName: "com.android.settings",className: "com.android.settings.Settings$AppDrawOverlaySettingsActivity",data: "package:" + context.getPackageName().toString()});} catch (err) {app.openAppSetting(getPackageName("智能机器人"));}toast("请打开悬浮窗开关");}if (!checked && auto.service != null) {//auto.service.disableSelf();toast("已关闭悬浮窗权限");}
});// 当用户回到本界面时,resume事件会被触发
ui.emitter.on("resume", function () {// 此时根据无障碍服务的开启情况,同步开关的状态ui.autoService.checked = auto.service != null;
});ui.start.on("click", () => { //按钮单击事件 哪个按钮 start 需要修改这个ID保存界面配置() //先读取配置读取界面配置(false)if (auto.service == null) {toastLog("请先开启无障碍服务!");return};if (!floaty.checkPermission()) {floaty.requestPermission()return}// 屏蔽音量键调节声音events.setKeyInterceptionEnabled("volume_up", true);//启用按键监听events.observeKey();//监听音量键按下events.onKeyDown("volume_up", () => {toastLog('按音量键停止');exit(); //停止、退出脚本});threads.start(function () { //线程启动主程序console.show()Main()});threads.start(function () { //线程启动主程序到期时间检测()});
});function Main() {sjb = "qieyu2020,qieyu2020," + myapp.SDKl;验证结果 = jhmyz(sjb, myapp.SDKl, rjbh, rjgxbh, jhmgxbh)if (parseInt(验证结果) == 1) {时间 = dqsj(sjb)toastLog("到期时间:" + 时间)} else {exit()}if (!files.exists(匹配话术路径)) { log("话术库txt文本不存在软件停止"); exit() }if (!files.exists(话术路径)) { log("话术txt文本不存在软件停止"); exit() }if (!files.exists(捡瓶子路径)) { log("捡瓶子话术txt文本不存在软件停止"); exit() }if (!files.exists(扔瓶子路径)) { log("扔瓶子话术txt文本不存在软件停止"); exit() }file = open(匹配话术路径); 匹配话术组 = file.readlines(); file.close()file = open(话术路径); 话术组 = file.readlines(); file.close()file = open(捡瓶子路径); 瓶子话术组 = file.readlines(); file.close()file = open(扔瓶子路径); 扔瓶子话术组 = file.readlines(); file.close()home()sleep(1000)if (myapp.xialasy == "0") {toastLog("当前执行任务 随缘漂流瓶...")if (!app.launchApp("随缘漂流瓶")) {toastLog("启动随缘漂流瓶失败!请手动启动!")}text("首页").waitFor();sleep(1000)while (true) {随缘广场()var x = random(0, 1)if (x == 0) {随缘捡瓶子()} else {随缘扔瓶子()}随缘消息回复()myapp.ppdelay = random(parseInt(myapp.ppdelayMin), parseInt(myapp.ppdelayMax))for (var i = myapp.ppdelay; i > 0; i--) {log("任务等待" + i + "秒")sleep(1000)}}} else if (myapp.xialasy == "1") {toastLog("当前执行任务 星梦漂流瓶...")if (!app.launchApp("星梦漂流瓶")) {toastLog("启动星梦漂流瓶失败!请手动启动!")}text("首页").waitFor();sleep(1000)while (true) {星梦匹配TA()星梦捡瓶子()星梦消息回复()myapp.ppdelay = random(parseInt(myapp.ppdelayMin), parseInt(myapp.ppdelayMax))for (var i = myapp.ppdelay; i > 0; i--) {log("任务等待" + i + "秒")sleep(1000)}}} else if (myapp.xialasy == "2") {toastLog("当前执行任务 窃语漂流瓶...")if (!app.launchApp("窃语漂流瓶")) {toastLog("启动窃语漂流瓶失败!请手动启动!")}text("首页").waitFor();sleep(1000)while (true) {窃语捡瓶子()窃语消息回复()myapp.ppdelay = random(parseInt(myapp.ppdelayMin), parseInt(myapp.ppdelayMax))for (var i = myapp.ppdelay; i > 0; i--) {log("任务等待" + i + "秒")sleep(1000)}}} else if (myapp.xialasy == "3") {toastLog("当前执行任务 逗萌漂流瓶...")if (!app.launchApp("逗萌漂流瓶")) {toastLog("启动逗萌漂流瓶失败!请手动启动!")}text("首页").waitFor();sleep(1000)while (true) {逗萌匹配TA()逗萌捡瓶子()逗萌消息回复()myapp.ppdelay = random(parseInt(myapp.ppdelayMin), parseInt(myapp.ppdelayMax))for (var i = myapp.ppdelay; i > 0; i--) {log("任务等待" + i + "秒")sleep(1000)}}}
}
function 随缘广场() {log("随缘广场任务")click("相遇")sleep(500)click("相遇")sleep(1000)click("广场")sleep(500)click("广场")sleep(1000)for (var h = 0; h < parseInt(myapp.syppnumber); h++) {clickN("com.sy.bottle:id/imgYes")sleep(1000)log("点击喜欢" + h + "次")myapp.delay = random(parseInt(myapp.delayMin), parseInt(myapp.delayMax))for (var i = myapp.delay; i > 0; i--) {log("下次喜欢" + i + "秒")sleep(1000)}}log("广场任务完成")
}
function 随缘捡瓶子() {log("随缘捡瓶子任务")var xx = 0click("相遇")sleep(500)click("相遇")sleep(1000)click(" 漂流瓶 ")sleep(500)click(" 漂流瓶 ")sleep(1000)myapp.ysyjpznumber = 0while (true) {if (xx == 20) { home(); sleep(1000); app.launchApp("随缘漂流瓶"); sleep(2000); break }if (id("com.sy.bottle:id/chat_message_input").findOnce()) {xx = 0log("开始发送消息")if (id("com.sy.bottle:id/msg_body_tv").findOnce()) {log("该用户已经回复过了")返回函数("com.sy.bottle:id/imgRefresh", "随缘漂流瓶")} else {x = random(0, 瓶子话术组.length - 1)var 话术 = 瓶子话术组[x]log("我要回复的话术:" + 话术)sleep(1000)setText(话术)sleep(1000)clickN("发送")sleep(1000)myapp.ysyjpznumber++返回函数("com.sy.bottle:id/imgRefresh", "随缘漂流瓶")if (myapp.ysyjpznumber == parseInt(myapp.syjpznumber)) {log("捡瓶子次数到了")return} else {log("当前已捡瓶子次数" + myapp.ysyjpznumber)myapp.delay = random(parseInt(myapp.delayMin), parseInt(myapp.delayMax))for (var i = myapp.delay; i > 0; i--) {log("捡瓶子等待" + i + "秒")sleep(1000)}}}} else if (text("回应TA").findOnce()) {log("点击回应TA")click("回应TA")} else if (id("com.sy.bottle:id/imgRefresh").findOnce()) {log("开始随机捡瓶子")var shuaxin = id("com.sy.bottle:id/imgRefresh").findOnce()if (shuaxin != null) { shuaxin.click() }sleep(1000)var arr = idContains("com.sy.bottle:id/bottle").find()if (arr.length > 0) {var x = random(0, arr.length - 1)arr[x].click()}} else {xx++}sleep(1000)}
}
function 随缘扔瓶子() {log("随缘扔瓶子任务")var xx = 0click("相遇")sleep(500)click("相遇")sleep(1000)click(" 漂流瓶 ")sleep(500)click(" 漂流瓶 ")sleep(1000)myapp.ysyrpznumber = 0while (true) {if (xx == 20) { home(); sleep(1000); app.launchApp("随缘漂流瓶"); sleep(2000); break }if (text("扔出去").findOnce()) {xx = 0log("开始扔出瓶子")x = random(0, 扔瓶子话术组.length - 1)var 话术 = 扔瓶子话术组[x]log("话术:" + 话术)sleep(1000)setText(话术)sleep(1000)clickN("扔出去")sleep(1000)if (text("扔出瓶子").findOne(3000)) {myapp.ysyrpznumber++if (myapp.ysyrpznumber == parseInt(myapp.syrpznumber)) {log("扔瓶子次数到了")return} else {log("当前已扔瓶子次数" + myapp.ysyrpznumber)myapp.delay = random(parseInt(myapp.delayMin), parseInt(myapp.delayMax))for (var i = myapp.delay; i > 0; i--) {log("扔瓶子等待" + i + "秒")sleep(1000)}}}} else if (text("扔出瓶子").findOnce()) {log("点击扔出瓶子")click("扔出瓶子")} else {xx++}sleep(1000)}
}
function 随缘消息回复() {log("开始随缘检测消息回复")click("消息")sleep(500)click("消息")sleep(1000)var 下滑 = true, 上滑 = falsevar x = 0while (true) {if (x == 20) { home(); sleep(1000); app.launchApp("随缘漂流瓶"); sleep(2000); x = 0 }if (id("com.sy.bottle:id/chat_message_input").findOnce()) {log("开始消息匹配")消息匹配("com.sy.bottle:id/msg_body_tv")返回函数("com.sy.bottle:id/conversation_title", "随缘漂流瓶")} else if (textContains("封停使用").id("com.sy.bottle:id/msg_body_tv").findOnce()) {back()sleep(1000)} else if (id("com.sy.bottle:id/conversation_title").findOnce()) {var xMsg = id("com.sy.bottle:id/conversation_unread").findOnce()if (xMsg != null) {log("找到找新消息")xMsg.parent().parent().click()} else {if (下滑) {if (滑动("下滑", "com.sy.bottle:id/conversationList", "com.sy.bottle:id/conversation_title")) {下滑 = false上滑 = true}}if (上滑) {if (滑动("上滑", "com.sy.bottle:id/conversationList", "com.sy.bottle:id/conversation_title")) {log("消息回复完毕")return}}}} else {x++}sleep(1000)}
}
function 星梦匹配TA() {log("开始星梦匹配任务..")var xx = 0, y = 0myapp.yxmppnumber = 0while (true) {if (xx == 20) { home(); sleep(1000); app.launchApp("星梦漂流瓶"); sleep(2000); break }if (id("com.xm.bottle:id/chat_message_input").findOnce()) {xx = 0y = 0log("开始发送消息")if (id("com.xm.bottle:id/msg_body_tv").findOnce()) {log("该匹配已经回复过了")返回函数("com.xm.bottle:id/iv_icon", "星梦漂流瓶")} else {x = random(0, 瓶子话术组.length - 1)var 话术 = 瓶子话术组[x]log("我要回复的话术:" + 话术)sleep(1000)setText(话术)sleep(1000)clickN("发送")sleep(1000)back()sleep(1000)myapp.yxmppnumber++返回函数("com.xm.bottle:id/iv_icon", "星梦漂流瓶")if (myapp.yxmppnumber == parseInt(myapp.xmppnumber)) {log("匹配次数到了")return} else {log("当前已匹配次数" + myapp.yxmppnumber)myapp.delay = random(parseInt(myapp.delayMin), parseInt(myapp.delayMax))for (var i = myapp.delay; i > 0; i--) {log("匹配等待" + i + "秒")sleep(1000)}}}} else if (text("去遇见").findOnce()) {log("匹配成功去遇见")clickN("去遇见")} else if (text("暂未匹配到人").findOnce()) {log("点击继续匹配")clickN("继续匹配")sleep(1000)y = 0myapp.yxmppnumber++if (myapp.yxmppnumber == parseInt(myapp.xmppnumber)) {log("匹配次数到了")返回函数("com.xm.bottle:id/iv_icon", "星梦漂流瓶")return} else {log("当前已匹配次数" + myapp.yxmppnumber)}} else if (text("正在匹配中").findOnce()) {log("正在匹配中....")y++if (y >= 35 && text("取消匹配").findOnce()) {log("匹配超时取消匹配")clickN("取消匹配")sleep(1000)y = 0myapp.yxmppnumber++if (myapp.yxmppnumber == parseInt(myapp.xmppnumber)) {log("匹配次数到了")返回函数("com.xm.bottle:id/iv_icon", "星梦漂流瓶")return} else {log("当前已匹配次数" + myapp.yxmppnumber)}}} else if (id("com.xm.bottle:id/iv_icon").findOnce()) {log("点击快速匹配")console.hide()sleep(1000)clickN("com.xm.bottle:id/iv_icon")console.show()} else if (text("清空").findOnce() || text("我的动态").findOnce() || text("附近动态").findOnce() || text("推荐").findOnce()) {log("点击发现")clickN("发现")} else if (text("取消").findOnce()) {log("点击取消")clickN("取消")} else if (id("com.xm.bottle:id/iv_close").findOnce()) {log("点击取消")clickN("com.xm.bottle:id/iv_close")} else {xx++}sleep(1000)}
}
function 星梦捡瓶子() {log("开始星梦捡瓶子任务..")var xx = 0myapp.yxmjpznumber = 0while (true) {if (xx == 20) { home(); sleep(1000); app.launchApp("星梦漂流瓶"); sleep(2000); break }if (id("com.xm.bottle:id/chat_message_input").findOnce()) {xx = 0log("开始发送消息")if (id("com.xm.bottle:id/msg_body_tv").findOnce()) {log("该用户已经回复过了")返回函数("刷新", "星梦漂流瓶")} else {x = random(0, 瓶子话术组.length - 1)var 话术 = 瓶子话术组[x]log("我要回复的话术:" + 话术)sleep(1000)setText(话术)sleep(1000)clickN("发送")sleep(1000)myapp.yxmjpznumber++if (myapp.yxmjpznumber == parseInt(myapp.xmjpznumber)) {log("捡瓶子次数到了")返回函数("com.xm.bottle:id/iv_icon", "星梦漂流瓶")return} else {返回函数("刷新", "星梦漂流瓶")log("当前已捡瓶子次数" + myapp.yxmjpznumber)myapp.delay = random(parseInt(myapp.delayMin), parseInt(myapp.delayMax))for (var i = myapp.delay; i > 0; i--) {log("捡瓶子等待" + i + "秒")sleep(1000)}}}} else if (text("回复").findOnce()) {log("点击回复")clickN("回复")} else if (text("刷新").findOnce()) {log("开始随机捡瓶子")var arr = idContains("com.xm.bottle:id/iv_avatar_").find()if (arr.length > 0) {var x = random(0, arr.length - 1)var rect = arr[x].bounds()if (parseInt(rect.centerY()) > 0) {console.hide()sleep(1000)click(rect.centerX(), rect.centerY())console.show()}} else {clickN("刷新")sleep(1000)myapp.yxmjpznumber++if (myapp.yxmjpznumber == parseInt(myapp.xmjpznumber)) {log("捡瓶子次数到了")返回函数("com.xm.bottle:id/iv_icon", "星梦漂流瓶")return}}} else if (text("漂流瓶,来自内心的声音…").findOnce()) {log("点击漂流瓶,来自内心的声音…")clickN("漂流瓶,来自内心的声音…")} else if (text("清空").findOnce() || text("我的动态").findOnce() || text("附近动态").findOnce() || text("推荐").findOnce()) {log("点击发现")clickN("发现")} else if (text("取消").findOnce()) {log("点击取消")clickN("取消")} else {xx++}sleep(1000)}
}