diff --git a/apps/pixiv.js b/apps/pixiv.js index 46a876c..07995ce 100644 --- a/apps/pixiv.js +++ b/apps/pixiv.js @@ -182,7 +182,7 @@ export class NewPixiv extends plugin { async pximg (e) { let ispro = /pro/.test(e.msg) if (!await this._Authentication(e, 'sese')) return - if (ispro && !await this._Authentication(e, 'sesepro')) return + if (ispro && !await this._Authentication(e, 'sesepro', false)) return await Pixiv.pximg(ispro) .then(res => ispro ? common.recallSendForwardMsg(e, [res]) : common.recallsendMsg(e, res, false, { anony: true })) @@ -243,7 +243,7 @@ export class NewPixiv extends plugin { .catch(err => e.reply(err.message)) } - async _Authentication (e, type) { + async _Authentication (e, type, limit = true) { if (e.isMaster) return true if (!Config.pixiv.allowPM && !e.isGroup) { e.reply('主人已禁用私聊该功能') @@ -254,7 +254,7 @@ export class NewPixiv extends plugin { e.reply(SWITCH_ERROR) return false } - if (!await common.limit(e.user_id, 'pixiv', Config.pixiv.limit)) { + if (limit && !await common.limit(e.user_id, 'pixiv', Config.pixiv.limit)) { e.reply('您已达今日「Pixiv」次数上限', true, { at: true }) return false } diff --git a/apps/setu.js b/apps/setu.js index b68443c..8c77b83 100644 --- a/apps/setu.js +++ b/apps/setu.js @@ -49,14 +49,13 @@ export class SeSe extends plugin { if (cdTime) return e.reply(` ${setu.CDMsg}你的CD还有${cdTime}`, false, { at: true }) let num = e.msg.match(new RegExp(NumReg)) - num = num ? common.translateChinaNum(num[0]) : 1 - if (num > 20) { return e.reply('❎ 最大张数不能大于20张') } else if (num > 6) { e.reply('你先等等,你冲的有点多~') } + // 开始执行 e.reply(setu.startMsg) diff --git a/lib/request/request.js b/lib/request/request.js index c9ab811..3f56426 100644 --- a/lib/request/request.js +++ b/lib/request/request.js @@ -35,7 +35,7 @@ export default new class { * @async * @function * @param {string} url - 请求的URL - * @param {import('node-fetch').RequestInit} [options={}] - 请求的配置项 + * @param {Object} [options={}] - 请求的配置项 * @param {Object} [options.params] - 请求的参数 * @param {Object} [options.headers] - 请求的HTTP头部 * @param {boolean} [options.closeCheckStatus=false] - 是否关闭状态检查 diff --git a/model/Pixiv.js b/model/Pixiv.js index 085ab20..1e1bd9d 100644 --- a/model/Pixiv.js +++ b/model/Pixiv.js @@ -463,20 +463,23 @@ export default new class Pixiv { } /** p站单图 */ - async pximg (type) { - let url = 'https://ovooa.caonm.net/API/Pximg/' - if (type) { - url = 'https://xiaobapi.top/api/xb/api/setu.php' + async pximg (pro) { + let url = 'https://image.anosu.top/pixiv/json' + const params = { + r18: pro ? 1 : 0, + proxy: this.proxy } - let res = await request.get(url).then(res => res.json()) - let { pid, uid, title, author, tags, urls, r18 } = res.data[0] || res.data - urls = urls.original.replace(/i.piccache.top|i.pixiv.re/, this.proxy) + let res = await request.get(url, { + statusCode: 'json', + params + }) + let { pid, uid, title, user, tags, url: urls, r18 } = res[0] let msg = [ `Pid: ${pid}\n`, `Uid: ${uid}\n`, - r18 ? `R18: ${r18}\n` : '', + `R18: ${r18 ?? false}\n`, `标题:${title}\n`, - `画师:${author}\n`, + `画师:${user}\n`, `Tag:${tags.join(',')}\n`, await this._requestPixivImg(urls) ]