代码拉取完成,页面将自动刷新
import fetch from 'node-fetch'
import plugin from '../../lib/plugins/plugin.js'
import common from "../../lib/common/common.js";
export class animal extends plugin {
constructor() {
super({
name: "娱乐集合",
dsc: "娱乐",
event: "message",
priority: 100,
rule: [
{
reg: "^#*搜狗百科(.*)$",
fnc: "sougou"
},
{
reg: "^#*百度百科(.*)$",
fnc: "baidu"
},
{
reg: "^#*查字典(.*)$",
fnc: "pinyin"
},
{
reg: "^#*垃圾分类(.*)$",
fnc: "laji"
},
{
reg: "^#*疯狂星期四$",
fnc: "feng"
},
{
reg: /^\p{Emoji_Presentation}{2}$/gum, //匹配消息正则,命令正则
fnc: 'emoji'
},
]
});
}
async sougou (e) {
let key = e.msg.replace(/#|搜狗百科/g, "").trim()
console.log(key)
if(!key) {e.reply("你要查询的内容呢?")
return;
}
let url = `https://xiaoapi.cn/API/bk.php?m=json&type=sg&msg=${key}`;
let response = await fetch(url);
let res = await response.json();
let msg = [
`${res.msg}\n\n`,
`更多详细:${res.more}\n`,
]
e.reply(msg);
}
async baidu (e) {
let key = e.msg.replace(/#|百度百科/g, "").trim()
console.log(key)
if(!key) {e.reply("你要查询的内容呢?")
return;
}
let url = `https://xiaoapi.cn/API/bk.php?m=json&type=bd&msg=${key}`;
let response = await fetch(url);
let res = await response.json();
let msg = [
segment.image(res.pic),
`${res.msg}\n\n`,
`更多详细:${res.more}\n`,
]
e.reply(msg);
}
async pinyin (e) {
let key = e.msg.replace(/#|查字典/g, "").trim()
console.log(key)
if(!key) {e.reply("你要查询的汉字呢?")
return;
}
let url = `https://xiaobapi.top/api/xb/api/search_zi.php?msg=${key}`;
let response = await fetch(url);
let res = await response.text();
e.reply(`${res}`);
}
async laji (e) {
let key = e.msg.replace(/#|垃圾分类/g, "").trim()
console.log(key)
if(!key) {e.reply("你要查询的垃圾呢?")
return;
}
let url = `https://xiaoapi.cn/API/zs_ljfl.php?msg=${key}`;
let response = await fetch(url);
let res = await response.json();
let msg = [
`垃圾:${res.question}\n`,
`类别:${res.type}\n`,
`详细:${res.type_name}\n`,
`处理方式:${res.tfyq}\n`
]
await e.reply(msg);
}
async feng (e) {
let url = `https://api.andeer.top/API/kfc.php`;
let response = await fetch(url);
let res = await response.json();
e.reply(`${res.data}`);
}
async emoji (e) {
//http://ovooa.com/API/emojimix/?emoji1=🥺&emoji2=😂
let bq = e.msg.replace(/表情合成/g, '').split(/(.{2})/g)
let url = 'http://ovooa.caonm.net/API/emojimix/?emoji1=' + bq[1] + '&emoji2=' + bq[3]
let res = await fetch(url)
res = await res.json()
if (res.text == '请输入正确的emoji' | res.text == '这两个emoji不支持合成') {
e.reply(res.text)
return
}
let msg = segment.image(res.data.url)
e.reply(msg)
console.log(res)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。