-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy path买家秀_Bncr.js
73 lines (70 loc) · 2.14 KB
/
买家秀_Bncr.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
/**作者
* @author 薛定谔的大灰机
* @name 买家秀
* @origin 大灰机
* @version 1.0.1
* @description 发送淘宝买家秀
* @platform tgBot qq ssh HumanTG wxQianxun wxXyo
* @rule ^(买家秀|mjx)
* @admin false
* @disable false
*/
const axios = require('axios')
module.exports = async s => {
let num = 10 // 数量
let time = 3 // 轮换时间
let delImage = true // 是否删除最后一条
let msg = `` // 标题
main()
async function main() {
for (let i = 0; i < num; i++) {
url = `https://api.uomg.com/api/rand.img3?format=json`;
if ((data = (await get(url)).data).code != 1) {
(await s.reply(`错误`))
return
}
image_url = encodeURI(String(data.imgurl))
if (i === 0) {
await s.delMsg(s.getMsgId())
if (s.getFrom() === 'HumanTG') {
if (!(msgid = await s.reply({
type: 'image',
path: image_url,
msg: msg
}))) return await main()
} else {
await s.reply({
type: 'image',
path: image_url,
// msg: msg
})
return
}
} else if (i > 0 && s.getFrom() === 'HumanTG') {
edit = await s.Bridge.editImage({
type: 'image',
path: image_url,
msg: msg,
groupId: s.getGroupId(),
userId: s.getUserId(),
msgId: msgid
});
if (!edit) continue
}
await sysMethod.sleep(time)
}
delImage && s.delMsg(msgid)
}
}
// get请求
async function get(url) {
var data = await axios({
"url": url,
"method": "get",
});
if (data.status === 200) {
return data
} else {
return
}
}