⚗️增加来n张推荐图
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
* 增加`Pixiv token登录`**墙内需代理**
|
||||
* 增加`#pixiv登录信息`查询登录状态
|
||||
* 增加`#来n张推荐图`需登录账号
|
||||
|
||||
# 1.1.0
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ export class NewPicSearch extends plugin {
|
||||
if (!await this.handelImg(e, 'SauceNAO')) return
|
||||
await PicSearch.SauceNAO(e.img[0])
|
||||
.then(async res => {
|
||||
if (res.message.length == 1)res.message = res.message[0]
|
||||
await (res.maxSimilarity > 80 || res.message.length == 1
|
||||
? common.recallsendMsg(e, res.message, true)
|
||||
: common.getRecallsendMsg(e, res.message))
|
||||
|
||||
@@ -54,6 +54,10 @@ export class NewPixiv extends plugin {
|
||||
reg: '^#?看?看?相关作品(\\d+)$',
|
||||
fnc: 'related'
|
||||
},
|
||||
{
|
||||
reg: '^#来(\\d+)?张推荐图$',
|
||||
fnc: 'illustRecommended'
|
||||
},
|
||||
{
|
||||
reg: '^#?(P|p)ximg(pro)?$',
|
||||
fnc: 'pximg'
|
||||
@@ -193,6 +197,18 @@ export class NewPixiv extends plugin {
|
||||
.catch(err => e.reply(err.message))
|
||||
}
|
||||
|
||||
async illustRecommended (e) {
|
||||
if (!await this.Authentication(e, 'sese')) return
|
||||
e.reply(Pixiv.startMsg)
|
||||
let num = e.msg.match(/\d+/) || 1
|
||||
await Pixiv.illustRecommended(num).then(res => {
|
||||
console.log(res)
|
||||
res.length == 1
|
||||
? common.recallsendMsg(e, res[0], true)
|
||||
: common.getRecallsendMsg(e, res)
|
||||
}).catch(err => e.reply(err.message))
|
||||
}
|
||||
|
||||
// 更换代理
|
||||
async setProxy (e) {
|
||||
let proxydef = [
|
||||
|
||||
@@ -42,8 +42,8 @@ export default async function doSearch (url) {
|
||||
Config.picSearch.hideImg ? '' : segment.image(item.image),
|
||||
`${item.info}\n`,
|
||||
`标题:${item.source?.text}\n`,
|
||||
`作者:${item.author?.text}(${item.author?.link})\n`,
|
||||
`来源:${item.source?.link}`
|
||||
`作者:${item.author?.text}(${item.author?.link})\n`,
|
||||
`来源:${item.source?.link}`
|
||||
]
|
||||
let color = colorData.map(mapfun)
|
||||
let bovw = bovwData.map(mapfun)
|
||||
|
||||
@@ -446,7 +446,7 @@ export default new class Pixiv {
|
||||
let illusts = []
|
||||
let filter = 0
|
||||
for (let i of res.illusts) {
|
||||
let { id, title, user, tags, total_bookmarks, image_urls, x_restrict } = this.format(i)
|
||||
let { id, title, user, tags, total_bookmarks, image_urls, x_restrict } = await this.format(i)
|
||||
if (isfilter && x_restrict) {
|
||||
filter++
|
||||
continue
|
||||
@@ -490,6 +490,23 @@ export default new class Pixiv {
|
||||
return msg
|
||||
}
|
||||
|
||||
async illustRecommended (num) {
|
||||
if (!this.PixivClient) throw Error('请登录Pixiv后再使用此功能')
|
||||
let list = await this.PixivClient.illustRecommended()
|
||||
return Promise.all(_.take(list.illusts, num).map(async (item) => {
|
||||
let { id, title, user, tags, total_bookmarks, image_urls } = this.format(item)
|
||||
return [
|
||||
`标题:${title}\n`,
|
||||
`画师:${user.name}\n`,
|
||||
`PID:${id}\n`,
|
||||
`UID:${user.id}\n`,
|
||||
`点赞:${total_bookmarks}\n`,
|
||||
`Tag:${_.truncate(tags)}\n`,
|
||||
await this.requestPixivImg(image_urls.large)
|
||||
]
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 请求p站图片
|
||||
* @param {String} url
|
||||
@@ -526,10 +543,6 @@ export default new class Pixiv {
|
||||
} else {
|
||||
url = meta_pages.map(item => item.image_urls.original)
|
||||
}
|
||||
return {
|
||||
...illusts,
|
||||
tags,
|
||||
url
|
||||
}
|
||||
return { ...illusts, tags, url }
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -168,4 +168,8 @@ export default class PixivApi {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async illustRecommended (params = {}) {
|
||||
return await this.request('v1/illust/recommended', params)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user