加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
百科字典垃圾星期四.js 3.60 KB
一键复制 编辑 原始数据 按行查看 历史
玉玉了 提交于 2023-05-28 12:38 . V3
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)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化