-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path能不能好好说话.js
51 lines (51 loc) · 1.42 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
import fetch from "node-fetch"
export class sxck extends plugin {
constructor () {
super({
name : '缩写查看',
dsc : '缩写查看',
event : 'message',
priority : 5000,
rule : [
{
reg: '^#*(sx|缩写) (.*)$',
fnc: 'sx'
}
]
})
}
async sx (e) {
let word = e.msg.replace(/#*(sx|缩写) /g, "").trim();
const url = "https://lab.magiconch.com/api/nbnhhsh/guess";
const data = {
"text": `${word}`
};
const resp = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Origin': 'https://lab.magiconch.com',
'Referer': 'https://lab.magiconch.com/nbnhhsh/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36',
},
body: JSON.stringify(data),
});
const result = await resp.json();
const content = result[0];
const name = content?.name;
let res = "";
const { trans, inputting } = content;
if (trans) {
res += trans.join(' , ');
}
if (inputting) {
res += inputting.join(' , ');
}
if (res) {
await e.reply(name + "可能解释为:\n" + res);
} else {
await e.reply(`没有找到缩写 ${word} 的可能释义`);
}
}
}