-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path机器人凤落.js
87 lines (78 loc) · 2.15 KB
/
机器人凤落.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//修复了几个错误
//打开QQ聊天界面就能自动聊天了
"auto"
t = 0; //延迟
toast("打开QQ消息界面自动聊天");
threads.start(notificationmsg);
while (true) {
other = "";
findMessage();
othersay = getMessage();
if (othersay != null) {
var info = othersay;
log("\n\nTa:\n" + ":" + othersay);
i = "";
i += Me();
i += "";
sendMessage(i);
log("我:\n" + i);
sleep(t)
back();
}
findboxmsg();
}
function Me() {
var url = "http://www.tuling123.com/openapi/api";
id1 = "llmjk";
var res = http.post(url, {
key: "767e8fb7cd8448759b23d1a0da38d33f", //图灵
info: info,
userid: "1",
});
var html = res.body.string();
eval("b=" + html);
return b.text;
}
function getMessage() {
var information = null;
if (id("chat_item_head_icon").exists() && id("chat_item_content_layout").exists()) {
var list = id("listView1").findOne(); num = list.childCount(); var n = 1; if (id("graybar").exists()) { i = 0; while (id("graybar").findOnce(i++) != null); n = i; } icon = id("chat_item_head_icon").findOnce(num - n); toastt = id("chat_item_content_layout").findOnce(num - n); if (toastt != null && icon != null) { x = icon.bounds().centerX(); y = icon.bounds().centerY(); if (x < 500) { information = toastt.text(); other = icon.text(); } }
}
return information;
}
function sendMessage(i) {
if (id("input").depth("2").exists()) {
id("input").depth("2").find().setText(i);
className("android.widget.Button").text("发送").find().click();
}
}
function findMessage() {
if (id("unreadmsg").exists()) {
unreadmsg = id("unreadmsg").findOnce(0);
x1 = unreadmsg.bounds().centerX();
y1 = unreadmsg.bounds().centerY();
click(x1 - 200, y1 - 50);
if (id("input").depth("2").findOne(2000) == null) {
back();
}
} else {
ismsg = className("android.widget.RelativeLayout").depth("4").drawingOrder("2").clickable(true).selected(true).findOne(100);
if (ismsg != null && ismsg.childCount() == 3) {
ismsg.click();
}
}
}
function findboxmsg() {
if (id("msgbox").exists()) {
id("msgbox").findOne().click();
}
}
function notificationmsg() {
var notifi;
events.observeNotification();
events.on("notification", function(n) {
if ("com.tencent.mobileqq" == n.getPackageName()) {
app.launch("com.tencent.mobileqq");
}
});
}