forked from SecondRobotics/SimTourneyBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
82 lines (75 loc) · 2.42 KB
/
Copy pathindex.ts
File metadata and controls
82 lines (75 loc) · 2.42 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
82
import type { GoogleSpreadsheetRow } from "google-spreadsheet";
import {
type Match as chargedUpMatch,
headerValues as chargedUpHeaderValues,
matchToArray as chargedUpMatchToArray,
saveMatchToRow as chargedUpSaveMatchToRow,
} from "./chargedUp";
import {
type Match as crescendoMatch,
headerValues as crescendoHeaderValues,
matchToArray as crescendoMatchToArray,
saveMatchToRow as crescendoSaveMatchToRow,
} from "./crescendo";
import {
type Match as rapidReactMatch,
headerValues as rapidReactHeaderValues,
matchToArray as rapidReactMatchToArray,
saveMatchToRow as rapidReactSaveMatchToRow,
} from "./rapidReact";
import {
type Match as reefscapeMatch,
headerValues as reefscapeHeaderValues,
matchToArray as reefscapeMatchToArray,
saveMatchToRow as reefscapeSaveMatchToRow,
} from "./reefscape";
import {
type Match as rebuiltMatch,
headerValues as rebuiltHeaderValues,
matchToArray as rebuiltMatchToArray,
saveMatchToRow as rebuiltSaveMatchToRow,
} from "./rebuilt";
let gameHeaderValues: string[];
let gameMatchToArray: (match: never) => (string | number)[];
let gameSaveMatchToRow: (match: never, row: GoogleSpreadsheetRow) => void;
switch (process.env.GAME_NAME) {
case "RAPID REACT":
gameHeaderValues = rapidReactHeaderValues;
gameMatchToArray = rapidReactMatchToArray;
gameSaveMatchToRow = rapidReactSaveMatchToRow;
break;
case "CHARGED UP":
gameHeaderValues = chargedUpHeaderValues;
gameMatchToArray = chargedUpMatchToArray;
gameSaveMatchToRow = chargedUpSaveMatchToRow;
break;
case "CRESCENDO":
gameHeaderValues = crescendoHeaderValues;
gameMatchToArray = crescendoMatchToArray;
gameSaveMatchToRow = crescendoSaveMatchToRow;
break;
case "REEFSCAPE":
gameHeaderValues = reefscapeHeaderValues;
gameMatchToArray = reefscapeMatchToArray;
gameSaveMatchToRow = reefscapeSaveMatchToRow;
break;
case "REBUILT":
default:
gameHeaderValues = rebuiltHeaderValues;
gameMatchToArray = rebuiltMatchToArray;
gameSaveMatchToRow = rebuiltSaveMatchToRow;
break;
}
export type Match =
| chargedUpMatch
| crescendoMatch
| rapidReactMatch
| reefscapeMatch
| rebuiltMatch;
export const headerValues = gameHeaderValues;
export const matchToArray = (match: Match) => {
return gameMatchToArray(match as never);
};
export const saveMatchToRow = (match: Match, row: GoogleSpreadsheetRow) => {
return gameSaveMatchToRow(match as never, row);
};