-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.mjs
More file actions
81 lines (71 loc) · 2.02 KB
/
index.mjs
File metadata and controls
81 lines (71 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { fetch, FetchResultTypes } from "@sapphire/fetch";
import { Result } from "@sapphire/result";
import { sleep } from "@sapphire/utilities";
import { writeFile } from "node:fs/promises";
import gen8Formats from "./formats-gen8.json" assert { type: "json" };
import gen9Formats from "./formats-gen9.json" assert { type: "json" };
const list1 = [];
for (const [key, value] of Object.entries(gen9Formats)) {
if (
(key.endsWith("mega") && key !== "yanmega") ||
key.endsWith("totem") ||
key.endsWith("alola") ||
key.endsWith("primal") ||
key === "castformsunny" ||
key === "castformrainy" ||
key === "castformsnowy" ||
key === "deoxysattack" ||
key === "deoxysdefense" ||
key === "deoxysspeed" ||
key === "charizardmegax" ||
key === "charizardmegay" ||
key === "floetteeternal" ||
key === "greninjaash" ||
key === "mewtwomegax" ||
key === "mewtwomegay" ||
key === "miniormeteor" ||
key === "necrozmaultra" ||
key === "pichuspikyeared" ||
key === "pikachubelle" ||
key === "pikachucosplay" ||
key === "pikachulibre" ||
key === "pikachuphd" ||
key === "pikachupopstar" ||
key === "pikachurockstar" ||
key === "shayminsky" ||
key === "wormadamsandy" ||
key === "wormadamtrash"
) {
continue;
}
const gen8entryForPokemon = gen8Formats[key];
if (gen8entryForPokemon) {
if (
value.toLowerCase() === "past" &&
gen8entryForPokemon.toLowerCase() === "past"
) {
list1.push(key);
}
}
}
const list2 = [];
for (const mon of list1) {
const result = await Result.fromAsync(
fetch(
`https://www.serebii.net/pokedex-swsh/${mon}`,
FetchResultTypes.Result
)
);
console.group(mon);
console.log("is error: ", result.isErr());
await sleep(500);
if (result.isErr()) {
const unwrapped = result.unwrapErr();
console.log(unwrapped.status);
console.groupEnd();
list2.push(mon);
}
console.groupEnd();
continue;
}
await writeFile("./both-gens-past.txt", list2.join("\n"));