From 4bb8efabe4af2693a52fc3608995da51969231c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8A=B1=E8=8A=B1=E8=8A=B1=E5=84=BF?= <860563585bxy@gmail.com> Date: Sat, 27 Jan 2024 17:53:32 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E6=98=9F=E7=90=BC=E9=A2=84?= =?UTF-8?q?=E4=BC=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/apps/mysNews.js | 11 +++++++---- plugins/genshin/model/mysNews.js | 20 ++++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/genshin/apps/mysNews.js b/plugins/genshin/apps/mysNews.js index 2570e9e..ee073bc 100644 --- a/plugins/genshin/apps/mysNews.js +++ b/plugins/genshin/apps/mysNews.js @@ -27,8 +27,8 @@ export class mysNews extends plugin { fnc: 'mysUrl' }, { - reg: '^#*原(石|神)(预估|盘点)$', - fnc: 'ysEstimate' + reg: '^#*原(石|神)|星(琼|铁)(预估|盘点)$', + fnc: 'mysEstimate' }, { reg: '^#*(星铁|原神|崩坏三|崩三|绝区零|崩坏二|崩二|崩坏学园二|未定|未定事件簿)?(开启|关闭)(公告|资讯)推送$', @@ -84,8 +84,11 @@ export class mysNews extends plugin { await this.reply(data) } - async ysEstimate() { - let data = await new MysNews(this.e).ysEstimate() + async mysEstimate() { + let args = ['版本原石', 218945821] + if (/星(琼|铁)/.test(this.e.msg)) + args = ['可获取星琼', 73779489] + let data = await new MysNews(this.e).mysEstimate(...args) if (!data) return await this.reply(data) } diff --git a/plugins/genshin/model/mysNews.js b/plugins/genshin/model/mysNews.js index 5cfe32b..04320ea 100644 --- a/plugins/genshin/model/mysNews.js +++ b/plugins/genshin/model/mysNews.js @@ -93,6 +93,9 @@ export default class MysNews extends base { case 'searchPosts': host = 'https://bbs-api.miyoushe.com/post/wapi/searchPosts?' break + case 'userInstantSearchPosts': + host = 'https://bbs-api.miyoushe.com/painter/api/user_instant/search/list?' + break // 帖子详情 case 'getPostFull': host += 'post/wapi/getPostFull?' @@ -243,21 +246,14 @@ export default class MysNews extends base { return this.replyMsg(img, `${param.data.post.subject}`) } - async ysEstimate() { - let msg = '版本原石盘点' - let res = await this.postData('searchPosts', { gids: 2, size: 20, keyword: msg }) - if (res?.data?.posts.length <= 0) { + async mysEstimate(keyword, uid) { + let res = await this.postData('userInstantSearchPosts', { keyword, uid, size: 20, offset: 0, sort_type: 2 }) + let postList = res?.data?.list + if (postList.length <= 0) { await this.e.reply('暂无数据') return false } - let postId = '' - for (let post of res.data.posts) { - if (post.user.uid == '218945821') { - postId = post.post.post_id - break - } - } - + let postId = postList[0].post.post.post_id if (!postId) { await this.e.reply('暂无数据') return false