From 271c766f815779f7e6827a49990b81d0088f524f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ca=28HCO=E2=82=83=29=E2=82=82?= <143723419+kaguramaisakuya@users.noreply.github.com> Date: Sat, 4 May 2024 20:59:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=91=E6=8D=A2=E7=A0=81?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4=E9=94=99=E8=AF=AF=20(#416)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/apps/exchange.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/plugins/genshin/apps/exchange.js b/plugins/genshin/apps/exchange.js index c6a713f..a1a30a2 100644 --- a/plugins/genshin/apps/exchange.js +++ b/plugins/genshin/apps/exchange.js @@ -4,7 +4,7 @@ import fetch from 'node-fetch' import MysInfo from '../model/mys/mysInfo.js' export class exchange extends plugin { - constructor () { + constructor() { super({ name: '兑换码', dsc: '前瞻直播兑换码', @@ -23,7 +23,7 @@ export class exchange extends plugin { }) } - async getCode () { + async getCode() { let reg = this.e.msg.match(/^(#|\*)?(原神|星铁|崩铁|崩三|崩坏三|崩坏3)?(直播|前瞻)?兑换码$/) this.uid = '75276550' if (reg[1] == '*' || ['星铁', '崩铁'].includes(reg[2])) { @@ -76,7 +76,7 @@ export class exchange extends plugin { await this.reply(msg) } - async getData (type) { + async getData(type) { let url = { index: `https://api-takumi.mihoyo.com/event/miyolive/index`, code: `https://api-takumi-static.mihoyo.com/event/miyolive/refreshCode?version=${this.code_ver}&time=${this.now}`, @@ -105,7 +105,7 @@ export class exchange extends plugin { } // 获取 "act_id" - async getActId () { + async getActId() { let ret = await this.getData('actId') if (ret.error || ret.retcode !== 0) { return '' @@ -123,8 +123,16 @@ export class exchange extends plugin { continue } let date = new Date(post.created_at * 1000) - date.setDate(date.getDate() + 1) - this.deadline = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} 12:00:00` + if (this.uid == '80823548') { + date.setDate(date.getDate() + 1) + this.deadline = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} 23:59:59` + } else if (this.uid == '73565430') { + date.setDate(date.getDate() + 5) + this.deadline = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} 12:00:00` + } else { + date.setDate(date.getDate() + 3) + this.deadline = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} 12:00:00` + } let structured_content = post.structured_content let result = structured_content.match(/{\"link\":\"https:\/\/webstatic.mihoyo.com\/bbs\/event\/live\/index.html\?act_id=(.*?)\\/) if (result) { @@ -134,7 +142,7 @@ export class exchange extends plugin { } // 兑换码使用 - async useCode () { + async useCode() { const cdkCode = this.e.msg.replace(/#(兑换码使用|cdk-u)/, '').trim() const res = await MysInfo.get(this.e, 'useCdk', { cdk: cdkCode }) if (res) {