mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
⚡️ 完善公告正则
This commit is contained in:
@@ -184,7 +184,7 @@ async function loadData(): Promise<void> {
|
||||
function getAnnoTime(content: string): string | false {
|
||||
const regexes = [
|
||||
/〓活动时间〓.*?\d\.\d版本期间持续开放/,
|
||||
/(?:〓活动时间〓|〓任务开放时间〓).*?\d\.\d版本更新(?:完成|)后永久开放/,
|
||||
/(?:〓活动时间〓|〓任务开放时间〓).*?(?:(\d\.\d版本更新(?:完成|))|(\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}).*?)后永久开放/,
|
||||
/(?:〓(?:活动|折扣)时间〓|祈愿时间|【上架时间】).*?(\d\.\d版本更新后).*?~.*?<t class="t_(?:gl|lc)".*?>(.*?)<\/t>/,
|
||||
/(?:〓(?:活动|折扣)时间〓|祈愿时间|【上架时间】).*?<t class="t_(?:gl|lc)".*?>(.*?)<\/t>.*?~.*?<t class="t_(?:gl|lc)".*?>(.*?)<\/t>/,
|
||||
/〓活动时间〓.*?(\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}).*?(\d\.\d版本结束)/,
|
||||
@@ -198,8 +198,11 @@ function getAnnoTime(content: string): string | false {
|
||||
const res = content.match(regexes[1]);
|
||||
if (res === null) return false;
|
||||
const regex2 = /\d\.\d版本更新(?:完成|)后永久开放/;
|
||||
const regex3 = /\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}/;
|
||||
const res2 = res[0].match(regex2);
|
||||
return res2 === null ? false : res2[0];
|
||||
if (res2 !== null) return res2[0];
|
||||
const res3 = res[0].match(regex3);
|
||||
return res3 === null ? false : `${res3[0]} 后永久开放`;
|
||||
}
|
||||
if (content.match(regexes[2])) {
|
||||
const res = content.match(regexes[2]);
|
||||
@@ -211,7 +214,7 @@ function getAnnoTime(content: string): string | false {
|
||||
}
|
||||
if (content.match(regexes[4])) {
|
||||
const res = content.match(regexes[4]);
|
||||
if (res != null) {
|
||||
if (res !== null) {
|
||||
const cnt = res[0].match(/〓/g);
|
||||
if (cnt && cnt.length > 2) return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user