加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
壁纸.js 8.77 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";
let NumReg = '[一壹二两三四五六七八九十百千万亿\\d]+'
export class animal extends plugin {
constructor() {
super({
name: "壁纸",
dsc: "随机壁纸",
event: "message",
priority: 500,
rule: [
{
reg: "^#*来个帅哥$",
fnc: "husband"
},
{
reg: "^#*来个猫猫$",
fnc: "mao"
},
{
reg: "^#*情侣头像$",
fnc: "cptou"
},
{
reg: "^#*甘城猫猫(.*)$",
fnc: "kkk"
},
{
reg: "^#*(mc|MC)酱(.*)$",
fnc: "mc"
},
{
reg: "^#*小(c|C)酱(.*)$",
fnc: "xiaoc"
},
{
reg: "^#*原神(图片|壁纸)(.*)$",
fnc: "yuans"
},
{
reg: "^#*兽猫酱(.*)$",
fnc: "shou"
},
{
reg: "^#*滑稽表情包(.*)$",
fnc: "huaji"
},
{
reg: "^#*柴郡表情包(.*)$",
fnc: "chaijun"
},
{
reg: "^#*原神表情包(.*)$",
fnc: "yuan"
},
{
reg: "^#*天使来到我身边(.*)$",
fnc: "tianshi"
},
{
reg: "^#*每日早报$",
fnc: "kanshijie"
},
]
});
}
async husband(e) {
e.reply("加载中...")
let url = "https://xiaobai.klizi.cn/API/img/boy.php"
let response = await fetch(url);
let res = await response.text();
await e.reply(segment.image(`${res}`),true)
return true;
}
async mao(e) {
//e.msg 用户的命令消息
console.log("用户命令:", e.msg);
//执行的逻辑功能
e.reply("猫猫加载中...")
let url = `http://edgecats.net/`;
let res = await fetch(url);
let msg = [segment.image(res.url)];
//发送消息
e.reply(msg,true);
return true; //返回true 阻挡消息不再往下
}
async cptou(e) {
//e.msg 用户的命令消息
console.log("用户命令:", e.msg);
//执行的逻辑功能
let url = `https://xiaobai.klizi.cn/API/other/sweethearts.php`;
let response = await fetch(url);
let res = await response.json();
let msg = [
segment.image(res.url1),
segment.image(res.url2),
];
//发出消息
await e.reply(msg,true);
return true; //返回true 阻挡消息不再往下
}
async kkk(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `https://xiaobapi.top/api/xb/api/gcmm.php`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async mc(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `http://api.caonm.net/api/mc/index.php`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async yuans(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `https://ovooa.caonm.net/API/yuan/?type=text`;
let res = await fetch(url)
res = await res.text()
//发出消息
await e.reply(segment.image(`${res}`),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async xiaoc(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `http://api.caonm.net/api/xc/index.php`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async shou(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `http://api.caonm.net/api/smj/index.php`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async huaji(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `http://api.caonm.net/api/huac/h.php?`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async chaijun(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `http://api.caonm.net/api/chai/c.php?`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async yuan(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `http://api.caonm.net/api/yuans/y.php?`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async tianshi(e) {
let num = e.msg.match(new RegExp(`(${NumReg})(张|份)`));
if (!num) {
num = 1;
} else {
num = Number(num[1]);
}
if (num>5) { e.reply("一次最多5张哦")
return;
}
let counter = 0;
while (counter < num ) {
let url = `https://xiaobapi.top/api/xb/api/tp.php`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
counter++;
// 等待5秒再获取下一张图片
await new Promise(resolve => setTimeout(resolve, 1 * 1000));
}
return true; //返回true 阻挡消息不再往下
}
async kanshijie(e) {
let url = `https://api.andeer.top/API/60s.php`;
let res = await fetch(url)
//发出消息
await e.reply(segment.image(res.url),true);
return true; //返回true 阻挡消息不再往下
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化