-
Notifications
You must be signed in to change notification settings - Fork 31
/
外卖红包 红叶整理版.js
119 lines (107 loc) · 3.5 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// [rule: 外卖]
// [rule: 外卖红包]
// [rule: 美团]
// [rule: 美团外卖]
// [rule: 美团红包]
// [rule: 美团外卖红包]
// [rule: 饿了么]
// [rule: 饿了么外卖]
// [rule: 饿了么红包]
// [rule: 饿了么外卖红包]
// [cron: 20 11,17 * * *]
/**
* @author 红叶
* @modify 2022-03-02
*/
/**
* 自定义部分
* mt:美团红包,可以放置多组随机取
* elm:饿了么红包,可以放置多组随机取
* groups:开启定时任务推送的群,自行配置
*/
var mt = [
["https://s2.loli.net/2022/02/21/kzfjpIFYZ9LeDn6.jpg", "https://s2.loli.net/2022/02/21/v4KVDUlp1d9SGzs.jpg", "https://s2.loli.net/2022/02/21/aukBLKISW6eHFoi.jpg"],
["https://s2.loli.net/2022/02/22/SaxeUO4sFnANvG7.jpg", "https://s2.loli.net/2022/02/22/QbC3N2pguMLP8GR.jpg", "https://s2.loli.net/2022/02/22/KGFJC5oYiVSIUjc.jpg"],
["https://s2.loli.net/2022/02/22/zi1EZGdr8kwSJnY.jpg", "https://s2.loli.net/2022/02/22/jOHkPRZvWQfBlob.jpg", "https://s2.loli.net/2022/02/22/4tHVwK1eCpQclP8.jpg"]
]
var elm = [
["https://s2.loli.net/2022/02/21/j8GUtlaS3csXCQ5.jpg", "https://s2.loli.net/2022/02/21/OrIiHKs7pjS9vP2.jpg"],
["https://s2.loli.net/2022/02/22/2ZLGEAxs5FNgOtH.jpg", "https://s2.loli.net/2022/02/22/PQ1lNAr9kBd6mDg.jpg", "https://s2.loli.net/2022/02/22/wOeHmp9ls7joLIK.jpg"]
]
var groups = [{
imType: "wx",
groupCode: 18843026371,
}, {
imType: "wx",
groupCode: 6565357519,
}, {
imType: "tg",
groupCode: 12345678910
}]
require('Math')
function pic2txt(x) {
var a = ""
for (var i = 0; i < x.length; ++i) {
a += image(x[i]);
}
return a
}
function getRandomMT() {
return pic2txt(mt[Math.floor(Math.random() * mt.length)])
}
function getRandomELM() {
return pic2txt(elm[Math.floor(Math.random() * elm.length)])
}
function main() {
var imType = ImType();
if (imType == 'fake') {
for (var i = 0; i < groups.length; i++) {
groups[i]["content"] = "快到饭点了,干饭机器人提醒大家要记得点外卖喔~" + getRandomELM() + getRandomMT()
push(groups[i])
}
return
}
var inTxt = GetContent()
if (inTxt.indexOf("饿了么") >= 0) {
if (imType == 'wxmp') {
var elms = elm[Math.floor(Math.random() * elm.length)]
sendImage(elms[Math.floor(Math.random() * elms.length)])
return
}
sendText("" + getRandomELM())
return
}
if (inTxt.indexOf("美团") >= 0) {
if (imType == 'wxmp') {
var mts = mt[Math.floor(Math.random() * mt.length)]
sendImage(mts[Math.floor(Math.random() * mts.length)])
return
}
sendText("" + getRandomMT())
return
}
var sec = param(1);
var i = 0;
while (sec == "" || sec == "0" || isNaN(sec)) {
if (sec == "q") {
sendText("客户输入" + sec + "已退出")
return
}
sendText("输入\"1\"选择「饿了么」输入\"2\"选择「美团」")
i++
if (i > 3) {
sendText("客户输入" + typeof sec + sec + ",输入错误次数过多,立即退出。")
return
}
sec = input()
if (typeof sec != 'number') {
sec = parseInt(sec)
}
}
if (sec > 1) {
sendText("" + getRandomMT() + "\n已成功获取美团外卖红包,请稍后领取使用。")
return
}
sendText("" + getRandomELM() + "\n已成功获取饿了么外卖红包,请稍后领取使用。")
}
main()