diff --git a/apps/st.js b/apps/st.js index 4c4ca0dae0e57a5bc3703cbbf4815a09d0525067..73c6e75baf00b31ca10ce07df350a494276a22fd 100644 --- a/apps/st.js +++ b/apps/st.js @@ -2,7 +2,6 @@ import { segment } from "oicq"; import fetch from "node-fetch"; import plugin from '../../../lib/plugins/plugin.js'; import common from'../../../lib/common/common.js' -import co from '../../../lib/common/common.js' import fs from 'fs' import YAML from 'yaml' export class St extends plugin { @@ -14,11 +13,11 @@ export class St extends plugin { priority: 1, rule: [ { - reg: '^#?清凉图$', + reg: '^#?(清凉图|涩图|涩涩)$', fnc: 'setu' }, { - reg: '^#?(\\d+张)清凉图$', + reg: '^#?(\\d+张)(清凉图|涩图|涩涩)$', fnc: 'moresetu' } ] @@ -34,6 +33,10 @@ export class St extends plugin { let isopen = set.ssttoooc let ismaster = masters.ssttooocmaster let lx = set.lx + let userInfo = { + user_id: this.e.user_id, + nickname: this.e.sender.card + } if (!isopen) { return false } else { @@ -48,25 +51,35 @@ export class St extends plugin { if (e.isGroup) { if (blacklist.groups.includes(e.group_id)) return false await e.reply('正在给你找图片啦~',true,{recallMsg:7}); - let image = [] + let msgList = [] let num = 1 let url = `https://api.lolicon.app/setu/v2?r18=${lx}`;//←此处修改图片类型,0为非18,1为18,2为18非18混合 let response = await fetch(url); let obj = await response.json(); console.log(obj); - image.push(segment.image(obj.data[0].urls.original)) - let abc = await e.reply(num = 1 ? await co.makeForwardMsg(e,image,'清凉图来啦') : image,false,{recallMsg:0});//群聊撤回间隔 + msgList.push({ + ...userInfo, + message: segment.image(obj.data[0].urls.original) + }) + // image.push(segment.image(obj.data[0].urls.original)) + let abc = await e.reply(num = 1 ? await Bot.makeForwardMsg(msgList,'清凉图来啦') : image,false,{recallMsg:0});//群聊撤回间隔 if (!abc) { return e.reply('好、好涩(//// ^ ////)……不、不行啦……被、被吞啦o(≧口≦)o',true,{recallMsg:60}); } return true; } await e.reply('正在给你找图片啦~',true,{recallMsg:7}); + let msgList = [] + let num = 1 let url = `https://api.lolicon.app/setu/v2?r18=${lx}`;//←此处修改图片类型,0为非18,1为18,2为18非18混合 let response = await fetch(url); let obj = await response.json(); console.log(obj); - let abc = await e.reply([segment.image(obj.data[0].urls.original)],false,{recallMsg:0});//私聊撤回间隔 + msgList.push({ + ...userInfo, + message: segment.image(obj.data[0].urls.original) + }) + let abc = await e.reply(num = 1 ? await Bot.makeForwardMsg(msgList,'清凉图来啦') : image,false,{recallMsg:0});//私聊撤回间隔 if (!abc) { return e.reply('好、好涩(//// ^ ////)……不、不行啦……被、被吞啦o(≧口≦)o',true,{recallMsg:60}); } @@ -83,6 +96,10 @@ export class St extends plugin { let isopen = set.ssttoooc let ismaster = masters.ssttooocmaster let lx = set.lx + let userInfo = { + user_id: this.e.user_id, + nickname: this.e.sender.card + } if (!isopen) { return false } else { @@ -99,17 +116,21 @@ export class St extends plugin { await e.reply('正在给你找图片啦~',true,{recallMsg:7}); let num = e.msg.match(/\d+/) if (num > shu) {num = shu;await e.reply('一次最多'+ shu +'张哦')}else {num = e.msg.match(/\d+/) } - let image = [] + let msgList = [] for (let i = 0; i < [num]; i++) { let url = `https://api.lolicon.app/setu/v2?r18=${lx}`;//←此处修改图片类型,0为非18,1为18,2为18非18混合 let response = await fetch(url); let obj = await response.json(); console.log(obj); - image.push(segment.image(obj.data[0].urls.original)) + msgList.push({ + ...userInfo, + message: segment.image(obj.data[0].urls.original) + }) + // image.push(segment.image(obj.data[0].urls.original)) console.log('已获取图片链接 ' + (i + 1) + ' 个'); await common.sleep(500); } - let abc = await e.reply(num > 1 ? await co.makeForwardMsg(e,image,'清凉图来啦') : image,false,{recallMsg:0});//群聊撤回间隔 + let abc = await e.reply(num > 1 ? await Bot.makeForwardMsg(msgList,'清凉图来啦') : image,false,{recallMsg:0});//群聊撤回间隔 if (!abc) { return e.reply('好、好涩(//// ^ ////)……不、不行啦……被、被吞啦o(≧口≦)o',true,{recallMsg:60}); } @@ -118,18 +139,23 @@ export class St extends plugin { await e.reply('正在给你找图片啦~',true,{recallMsg:7}); let num = e.msg.match(/\d+/) if (num > shu) {num = shu;await e.reply('一次最多'+ shu +'张哦')}else {num = e.msg.match(/\d+/) } + let msgList = [] for (let i = 0; i < [num]; i++) { let url = `https://api.lolicon.app/setu/v2?r18=${lx}`;//←此处修改图片类型,0为非18,1为18,2为18非18混合 let response = await fetch(url); let obj = await response.json(); console.log(obj); - let abc = await e.reply([segment.image(obj.data[0].urls.original)],false,{recallMsg:0});//私聊撤回间隔 + msgList.push({ + ...userInfo, + message: segment.image(obj.data[0].urls.original) + }) + console.log('已获取图片链接 ' + (i + 1) + ' 个'); + await common.sleep(500); + } + let abc = await e.reply(num > 1 ? await Bot.makeForwardMsg(msgList,'清凉图来啦') : image,false,{recallMsg:0});//私聊撤回间隔 if (!abc) { return e.reply('好、好涩(//// ^ ////)……不、不行啦……被、被吞啦o(≧口≦)o',true,{recallMsg:60}); } - console.log('已获取图片链接 ' + (i + 1) + ' 个'); - await common.sleep(500); - } return true; } } \ No newline at end of file