Fix Steam ID being skipped/cleared

This commit is contained in:
mtkennerly 2022-07-05 15:39:39 +08:00
parent 77809e7ed9
commit 4d8218b042
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
2 changed files with 11 additions and 8 deletions

View file

@ -50820,6 +50820,7 @@ Dirty Education:
renamedFrom:
- Dirty Education / 肉的教育
revId: 1261825
steam: 1018040
Dirty Fighter 1:
pageId: 65329
revId: 1184703

View file

@ -90,13 +90,15 @@ export class WikiGameCacheFile extends YamlFile<WikiGameCache> {
continue;
}
}
if (games.length > 0 && !games.includes(pageTitle)) {
if (games.length > 0) {
if (!games.includes(pageTitle)) {
continue;
}
} else if (!all && this.data[pageTitle].revId !== null && !this.data[pageTitle].recentlyChanged) {
continue;
}
// console.log(`Refreshing wiki page ${pageTitle}`);
// console.log(`Refreshing wiki page: ${pageTitle}`);
await getGame(pageTitle, this.data, client);
i++;
@ -139,8 +141,8 @@ export class WikiGameCacheFile extends YamlFile<WikiGameCache> {
console.log(`[ M ] ${recentName} <<< ${existingName}`);
renamed = true;
this.data[recentName] = {
...existingInfo,
pageId: recentInfo.pageId,
revId: existingInfo.revId,
recentlyChanged: true,
renamedFrom: [...(existingInfo.renamedFrom ?? []), existingName]
};
@ -568,7 +570,7 @@ export async function getGame(pageTitle: string, cache: WikiGameCache, client: W
delete cache[pageTitle].templates;
page.parse().each("template", template => {
const templateName = template.name.toLowerCase();
if (templateName === "Infobox game") {
if (templateName === "infobox game") {
const steamId = Number(template.parameters["steam appid"]);
if (!isNaN(steamId) && steamId > 0) {
cache[pageTitle].steam = steamId;