add:星琼预估

This commit is contained in:
小花花花儿 2024-01-27 17:53:32 +08:00
parent a5cb607c98
commit 4bb8efabe4
2 changed files with 15 additions and 16 deletions

View File

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

View File

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