-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path每日一图.js
38 lines (36 loc) · 1.02 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
import plugin from '../../lib/plugins/plugin.js'
import fetch from 'node-fetch'
let apiLink = 'https://api.boxmoe.com/random.php?return=json'
let bingphotoapi = 'https://api.paugram.com/bing/'
export class dayPhoto extends plugin {
constructor() {
super({
name: '每日一图',
dsc: '每日一图',
event: 'message',
priority: 30,
rule: [
{
reg: '^#?(每日)?一图$',
fnc: 'bing'
},
{
reg: '^#?来份二次元$',
fnc: 'photo'
},
]
})
}
async photo(e) {
let response = await fetch(apiLink);
const data = await response.json();
if (!data) {
e.reply(`获取图片地址失败`)
return
}
e.reply(segment.image(data.imgurl))
}
async bing(e) {
e.reply(segment.image(bingphotoapi))
}
}