diff --git a/apps/daily.js b/apps/daily.js new file mode 100644 index 0000000..6e73f89 --- /dev/null +++ b/apps/daily.js @@ -0,0 +1,80 @@ +import common from '../../../lib/common/common.js' +import fetch from 'node-fetch' +import schedule from 'node-schedule' +import { Group, segment } from 'oicq' + +// 指定定时发送的群号 +const groupList = [ '169721415' ] + +// 是否开启定时推送,默认为 true +let isAutoPush = true +function autoTask (func, time) { + if (isAutoPush) { + schedule.scheduleJob(time, () => { + for (let i = 0; i < groupList.length; i++) { + let group = Bot.pickGroup(groupList[i]) + func(group) + common.sleep(1000) + } + }) + } +} + +// 定时任务合集 +autoTask(pushDailyWorld, '0 30 8 * * ?') + +export class daily extends plugin { + constructor (e) { + super({ + name: 'rconsole插件帮助', + dsc: 'rconsole插件帮助插件帮助', + event: 'message', + priority: 500, + rule: [ + { + reg: '^#每天60秒$', + fnc: 'pushDailyWorld' + }, + { + reg: '^#开关每日推送$', + fnc: 'shutdown' + }, + ] + }) + } + + async dailyWorld (e) { + // 定时发送时间,采用 Cron 表达式,当前默认为每日 8:30 分推送 + await pushDailyWorld(e) + return true + } + + async shutdown (e) { + isAutoPush = !isAutoPush + e.reply(`【当前推送状态】:${ isAutoPush ? '开启' : '关闭' }`) + } +} + +/** + * 推送每天60秒读懂世界 + * @param e oicq传递的事件参数e + */ +async function pushDailyWorld (e) { + // 每天60秒读懂世界接口地址 + const url = await fetch('http://bjb.yunwj.top/php/tp/lj.php') + .catch(err => logger.error(err)) + const imgUrl = await url.json() + const res = await imgUrl.tp + + // 判断接口是否请求成功 + if (!res) { + e.reply('[60秒读懂世界] 接口请求失败') + } + + // 回复消息 + if (e instanceof Group) { + e.sendMsg(segment.image(res)) + } else { + e.reply(segment.image(res)) + } +} \ No newline at end of file diff --git a/apps/mystery.js b/apps/mystery.js index 43a4558..37e49bd 100644 --- a/apps/mystery.js +++ b/apps/mystery.js @@ -40,7 +40,7 @@ export class mystery extends plugin { reg: '^#(雀食|确实)$', fnc: 'mystery' }, { - reg: '^#来份涩图$', fnc: 'setu' + reg: '^#*来份涩图 (.*)$', fnc: 'setu' }, { reg: '^#(累了)$', fnc: 'cospro' @@ -49,7 +49,7 @@ export class mystery extends plugin { reg: '^#(啊?|啊?)$', fnc: 'aaa' }, { - reg: '^#沃日吗$', fnc: 'tuiimg' + reg: '^#我去', fnc: 'tuiimg' } ] }) @@ -215,20 +215,33 @@ export class mystery extends plugin { } async setu (e) { + const keyword = e.msg.split(' ')[1] const numb = this.mysteryConfig.setu.count - // 图源 - const urlList = [ 'https://iw233.cn/api.php?sort=random', 'https://iw233.cn/API/Random.php' ] - e.reply('探索中...') - let images = [] - for (let i = numb; i > 0; i--) { - urlList.forEach(url => { - images.push({ - message: segment.image(url), nickname: this.e.sender.card || this.e.user_id, user_id: this.e.user_id - }) + await e.reply('正在给你找图片啦~', true, { recallMsg: 7 }); + + let url = `https://api.lolicon.app/setu/v2?r18=${ keyword }&num=${ numb }`;//←此处修改图片类型,0为非18,1为18,2为18非18混合 + const response = await fetch(url); + const imgJson = await response.json(); + + const images = [] + for (let image of imgJson.data) { + images.push({ + message: segment.image(image.urls.original), + nickname: e.sender.card || e.user_id, + user_id: e.user_id }) - await common.sleep(200) } - return !!(await this.reply(await Bot.makeForwardMsg(images))) + + const res = await this.reply( + await Bot.makeForwardMsg(images), + false, + { recallMsg: 60 }) + + if (!res) { + return e.reply('好、好涩(//// ^ ////)……不、不行啦……被、被吞啦o(≧口≦)o',true,{recallMsg:60}); + } + + return true } async tuiimg (e) { @@ -258,7 +271,7 @@ export class mystery extends plugin { const images = [] let img while ((img = imgRex.exec(string))) { - images.push(`https://www.cos6.net/${img[1]}.jpg`) + images.push(`https://www.cos6.net/${ img[1] }.jpg`) } return images } diff --git a/apps/query.js b/apps/query.js index 21702d7..ce6993a 100644 --- a/apps/query.js +++ b/apps/query.js @@ -34,6 +34,10 @@ export class query extends plugin { { reg: '^#(热搜)(.*)$', fnc: 'hotSearch' + }, + { + reg: '#买家秀', + fnc: 'buyerShow' } ] }) @@ -176,10 +180,10 @@ export class query extends plugin { continue } const template = ` - 标题:${ _.isNull(element.title) ? '暂无' : element.title}\n + 标题:${ _.isNull(element.title) ? '暂无' : element.title }\n 简介:${ _.isNull(element.desc) ? '暂无' : element.desc }\n - 热度:${ _.isNull(element.hot) ? '暂无' : element.hot}\n - 访问详情:${ _.isNull(element.url) ? '暂无' : element.url}\n + 热度:${ _.isNull(element.hot) ? '暂无' : element.hot }\n + 访问详情:${ _.isNull(element.url) ? '暂无' : element.url }\n `; msg.push({ message: { type: 'text', text: `${ template }` }, @@ -191,6 +195,15 @@ export class query extends plugin { return !!this.reply(await Bot.makeForwardMsg(msg)) } + async buyerShow (e) { + const urls = ['https://api.vvhan.com/api/tao', 'http://3650000.xyz/api/?type=img'] + const randomIndex = Math.floor(Math.random() * urls.length); + const randomElement = urls.splice(randomIndex, 1)[0]; + await fetch(randomElement).then(resp => { + e.reply(segment.image(resp.url)) + }) + return true + } // 删除标签 removeTag (title) { diff --git a/apps/tools.js b/apps/tools.js index b0cb050..7647015 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -40,12 +40,19 @@ export class tools extends plugin { reg: "^#(wiki|百科)(.*)$", fnc: "wiki", }, + { + reg: "^#wc$", + fnc: "wcGirl", + } ], }); - // 视频保存路径 - this.defaultPath = `./data/rcmp4/` + http://api.tuwei.space/girl + // 视频保存路径 + this.defaultPath = `./data/rcmp4/` // redis的key this.redisKey = `Yz:tools:cache:${ this.group_id }` + // 代理接口 + this.myProxy = 'http://10.0.8.10:7890' } // 翻译插件 @@ -75,10 +82,11 @@ export class tools extends plugin { await this.douyinRequest(douUrl).then((res) => { const douRex = /.*video\/(\d+)\/(.*?)/g; const douId = douRex.exec(res)[1]; - const url = `https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=${ douId }`; + // const url = `https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=${ douId }`; + const url = `https://www.iesdouyin.com/aweme/v1/web/aweme/detail/?aweme_id=${ douId }&aid=1128&version_name=23.5.0&device_platform=android&os_version=2333` return fetch(url) .then((resp) => resp.json()) - .then((json) => json.item_list[0]) + .then((json) => json.aweme_detail) .then((item) => item.video.play_addr.url_list[0]) .then((url) => { this.downloadVideo(url).then(video => { @@ -100,27 +108,19 @@ export class tools extends plugin { await fetch(temp_url, { redirect: "follow", follow: 10, - agent: new HttpProxyAgent("http://10.0.8.10:7890") + timeout: 10000, + agent: new HttpProxyAgent(this.myProxy) }).then((resp) => { url = resp.url }) } else { url = urlRex.exec(url)[0] } - const getIdVideo = (url) => { - const matching = url.includes("/video/") - if(!matching){ - e.reply("没找到,正在获取随机视频!") - return null - } - const idVideo = url.substring(url.indexOf("/video/") + 7, url.length); - return (idVideo.length > 19) ? idVideo.substring(0, idVideo.indexOf("?")) : idVideo; - } - const idVideo = await getIdVideo(url) + const idVideo = await this.getIdVideo(url) e.reply('识别:tiktok, 正在解析...') - const API_URL = `https://api19-core-useast5.us.tiktokv.com/aweme/v1/feed/?aweme_id=${idVideo}&version_code=262&app_name=musical_ly&channel=App&device_id=null&os_version=14.4.2&device_platform=iphone&device_type=iPhone9`; + const API_URL = `https://api19-core-useast5.us.tiktokv.com/aweme/v1/feed/?aweme_id=${ idVideo }&version_code=262&app_name=musical_ly&channel=App&device_id=null&os_version=14.4.2&device_platform=iphone&device_type=iPhone9`; - axios.get(API_URL, { + await axios.get(API_URL, { headers: { "User-Agent": "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36", @@ -128,8 +128,8 @@ export class tools extends plugin { }, timeout: 10000, proxy: false, - httpAgent: tunnel.httpOverHttp({proxy: {host: '10.0.8.10', port: '7890'}}), - httpsAgent: tunnel.httpOverHttp({proxy: {host: '10.0.8.10', port: '7890'}}), + httpAgent: tunnel.httpOverHttp({ proxy: { host: '10.0.8.10', port: '7890' } }), + httpsAgent: tunnel.httpOverHttp({ proxy: { host: '10.0.8.10', port: '7890' } }), }).then(resp => { const data = resp.data this.downloadVideo(data.aweme_list[0].video.play_addr.url_list[0]).then(video => { @@ -214,15 +214,36 @@ export class tools extends plugin { const data = res[1] const data2 = res[0] const template = ` - 解释:${ _.isUndefined(data.msg) ? '暂无' : data.msg }\n - 详情:${ _.isUndefined(data.more) ? '暂无' : data.more }\n - 小鸡解释:${ _.isUndefined(data2.content) ? '暂无' : data2.content } + 解释:${ _.get(data, 'msg') }\n + 详情:${ _.get(data, 'more') }\n + 小鸡解释:${ _.get(data2, 'content') } `; e.reply(template) }) return true } + // 随机小姐姐视频 + async wcGirl (e) { + await axios.post('http://api.tuwei.space/girl', { + headers: { + "User-Agent": + "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36", + }, + timeout: 10000, + "status": 1, + "type": 1 + }) + .then(resp => { + console.log(`http://api.tuwei.space/upload/${ encodeURI(resp.data.data.Path) }`) + this.downloadVideo(`http://api.tuwei.space/upload/${ encodeURI(resp.data.data.Path) }`) + .then(video => { + e.reply(segment.video(`${ this.defaultPath }${ this.e.group_id || this.e.user_id }/temp.mp4`)); + }) + }) + return true + } + // 请求参数 async douyinRequest (url) { const params = { @@ -273,6 +294,17 @@ export class tools extends plugin { }); } + // 工具:找到tiktok的视频id + async getIdVideo (url) { + const matching = url.includes("/video/") + if (!matching) { + this.e.reply("没找到,正在获取随机视频!") + return null + } + const idVideo = url.substring(url.indexOf("/video/") + 7, url.length); + return (idVideo.length > 19) ? idVideo.substring(0, idVideo.indexOf("?")) : idVideo; + } + // 工具:下载哔哩哔哩 async downBili (title, videoUrl, audioUrl) { return Promise.all([ diff --git a/config/help.yaml b/config/help.yaml index 6aa204c..0d23cac 100644 --- a/config/help.yaml +++ b/config/help.yaml @@ -30,8 +30,8 @@ title: "#啊?" desc: 啊? - icon: pic5 - title: "#沃日吗" - desc: 什么鬼? + title: "#我去" + desc: 神秘的芒果 - group: 工具类合集 list: - icon: translate diff --git a/config/mystery.yaml b/config/mystery.yaml index 21f39ff..37cb79a 100644 --- a/config/mystery.yaml +++ b/config/mystery.yaml @@ -3,14 +3,14 @@ mystery: maxPage: 15 maxPigObj: 10 # 限制最大图片数量 - imageCountLimit: 20 + imageCountLimit: 10 aaa: # 最大页数 maxPage: 15 maxPigObj: 10 # 限制最大图片数量 - imageCountLimit: 20 + imageCountLimit: 10 setu: - count: 10 + count: 2 tuiimg: - count: 10 \ No newline at end of file + count: 5 \ No newline at end of file diff --git a/config/version.yaml b/config/version.yaml index 23a24ce..1b31fef 100644 --- a/config/version.yaml +++ b/config/version.yaml @@ -1,5 +1,5 @@ - { - version: 1.0.1, + version: 1.0.2, data: [ 更改单个组件#任助理架构为插件架构,