代码拉取完成,页面将自动刷新
import fetch from "node-fetch";
import plugin from '../../lib/plugins/plugin.js';
import common from '../../lib/common/common.js'
//1.定义命令规则
export class example extends plugin {
constructor() {
super({
/** 功能名称 */
name: 'mv',
/** 功能描述 */
dsc: '简单开发示例',
/** https://oicqjs.github.io/oicq/#events */
event: 'message',
/** 优先级,数字越小等级越高 */
priority: 5000,
rule: [
{
/** 命令正则匹配 */
reg: "^#*酷狗mv(.*)$",
/** 执行方法 */
fnc: 'gou'
},
{
/** 命令正则匹配 */
reg: "^#*酷我mv(.*)$",
/** 执行方法 */
fnc: 'wo'
},
]
})
}
//执行方法
async gou(e) {
logger.info('[用户命令]', e.msg)
let keyword = e.msg.replace("#", " ");
keyword = keyword.replace("酷狗mv", " ");
e.reply('请稍等,马上就来~');
let url = `http://ovooa.caonm.net/API/kg_mv/?msg=${keyword}&n=1`;
let response = await fetch(url);
let res = await response.json();
let url1 = `http://ovooa.caonm.net/API/kg_mv/?msg=${keyword}&n=2`;
let response1 = await fetch(url1);
let res1 = await response1.json();
let url2 = `http://ovooa.caonm.net/API/kg_mv/?msg=${keyword}&n=3`;
let response2 = await fetch(url2);
let res2 = await response2.json();
let url3 = `http://ovooa.caonm.net/API/kg_mv/?msg=${keyword}&n=4`;
let response3 = await fetch(url3);
let res3 = await response3.json();
let url4 = `http://ovooa.caonm.net/API/kg_mv/?msg=${keyword}&n=5`;
let response4 = await fetch(url4);
let res4 = await response4.json();
let msg = [
`1:${res.data.name}\n`,
segment.image(res.data.cover),
`视频链接:${res.data.url}\n`,
`2:${res1.data.name}\n`,
segment.image(res1.data.cover),
`视频链接:${res1.data.url}\n`,
`3:${res2.data.name}\n`,
segment.image(res2.data.cover),
`视频链接:${res2.data.url}\n`,
`4:${res3.data.name}\n`,
segment.image(res3.data.cover),
`视频链接:${res3.data.url}\n`,
`5:${res4.data.name}\n`,
segment.image(res4.data.cover),
`视频链接:${res4.data.url}\n`,
];
//
let ForwardMsg = await common.makeForwardMsg(this.e,msg);
await e.reply(ForwardMsg);
return true; //返回true 阻挡消息不再往下
}
//执行方法
async wo(e) {
logger.info('[用户命令]', e.msg)
let keyword = e.msg.replace("#", " ");
keyword = keyword.replace("酷我mv", " ");
e.reply('请稍等,马上就来~');
let url = `https://xiaobai.klizi.cn/API/music/kwmv.php?msg=${keyword}&n=1`;
let response = await fetch(url);
let res = await response.json();
let url1 = `https://xiaobai.klizi.cn/API/music/kwmv.php?msg=${keyword}&n=2`;
let response1 = await fetch(url1);
let res1 = await response1.json();
let url2 = `https://xiaobai.klizi.cn/API/music/kwmv.php?msg=${keyword}&n=3`;
let response2 = await fetch(url2);
let res2 = await response2.json();
let url3 = `https://xiaobai.klizi.cn/API/music/kwmv.php?msg=${keyword}&n=4`;
let response3 = await fetch(url3);
let res3 = await response3.json();
let url4 = `https://xiaobai.klizi.cn/API/music/kwmv.php?msg=${keyword}&n=5`;
let response4 = await fetch(url4);
let res4 = await response4.json();
let msg = [
`1:${res.name}\n`,
segment.image(res.img),
`视频链接:${res.url}\n`,
`2:${res1.name}\n`,
segment.image(res1.img),
`视频链接:${res1.url}\n`,
`3:${res2.name}\n`,
segment.image(res2.img),
`视频链接:${res2.url}\n`,
`4:${res3.name}\n`,
segment.image(res3.img),
`视频链接:${res3.url}\n`,
`5:${res4.name}\n`,
segment.image(res4.img),
`视频链接:${res4.url}\n`,
];
//
let ForwardMsg = await common.makeForwardMsg(this.e,msg);
await e.reply(ForwardMsg);
return true; //返回true 阻挡消息不再往下
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。