修改pximgpro为纯不适合所有年龄分段的图片

This commit is contained in:
yeyang
2023-04-18 17:29:22 +08:00
parent 37a53f5fb0
commit 0e934aeac4
4 changed files with 17 additions and 15 deletions

View File

@@ -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
}

View File

@@ -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)

View File

@@ -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] - 是否关闭状态检查

View File

@@ -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)
]