From 299aa0952aafb52a1c53f49122652a557e3bca9e Mon Sep 17 00:00:00 2001 From: sameu Date: Tue, 7 Feb 2023 16:45:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B6=88=E6=81=AF=E4=BC=AA?= =?UTF-8?q?=E8=A3=85=EF=BC=8C=E5=B9=B6=E4=BF=AE=E5=A4=8D=E7=A7=81=E8=81=8A?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/st.js | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/apps/st.js b/apps/st.js index 4c4ca0d..73c6e75 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 -- Gitee