-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstation_emojis.ts
220 lines (211 loc) · 6.47 KB
/
station_emojis.ts
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
import { getSunrise, getSunset } from "sunrise-sunset-js";
import { customEmojisAvailable, shouldDisplayMay1stCustomEmoji } from "./utilities.js";
// Enum with three possible values:
// - day
// - night
// - between
enum DayNightStatus {
day,
night,
between,
horizonSun,
}
// Offset a date by a number of minutes
function addMinutes(date: Date, minutes: number): Date {
return new Date(date.getTime() + minutes * 60000);
}
function getDayNightStatus(): DayNightStatus {
// Latitude and longitude of Strasbourg
const lat = 48.5734053;
const lon = 7.7521113;
// Store sunrise date
let sunrise = getSunrise(lat, lon);
let sunset = getSunset(lat, lon);
// Dawn start
let dawnStart = addMinutes(sunrise, -15);
// Dusk
let duskEnd = addMinutes(sunset, 20);
// Current time
let now = new Date();
if (now < dawnStart) {
return DayNightStatus.night;
} else if (now >= dawnStart && now < sunrise) {
return DayNightStatus.between;
} else if (now >= sunrise && now < addMinutes(sunrise, 20)) {
return DayNightStatus.horizonSun;
} else if (
now >= addMinutes(sunrise, 20) &&
now < addMinutes(sunset, -20)
) {
return DayNightStatus.day;
} else if (now >= addMinutes(sunset, -20) && now < addMinutes(sunset, 5)) {
return DayNightStatus.horizonSun;
} else if (now >= addMinutes(sunset, 5) && now < duskEnd) {
return DayNightStatus.between;
} else {
return DayNightStatus.night;
}
}
export function emojiForStation(station: string): string | null {
switch (station) {
case "Esplanade":
switch (getDayNightStatus()) {
case DayNightStatus.day:
return "🏙";
case DayNightStatus.between:
return "🌆";
case DayNightStatus.night:
return "🌃";
case DayNightStatus.horizonSun:
return "🌇";
default:
return "🏙";
}
case "Palerme":
return "🍕";
case "Rome":
return "🇮🇹";
case "Université":
return "🎓";
case "Observatoire":
return "🔭";
case "Cité Administrative":
return "🏢";
case "Campus d'Illkirch":
return "🔬";
case "Musée d'Art Moderne":
return "🧑🎨";
case "Homme de Fer":
return "⚔️";
case "Londres":
return "🇬🇧";
case "Port du Rhin":
return "⚓️";
case "Jean Jaures":
if (shouldDisplayMay1stCustomEmoji()) {
return "🌹 <:lilyofthevalley:1102362759141785610>";
} else {
return "🌹";
}
case "Winston Churchill":
return "🇬🇧";
case "Kehl Bahnhof":
return "🇩🇪 🚉";
case "Hochschule / Läger":
return "🇩🇪 🎓";
case "Kehl Rathaus":
return "🇩🇪 🏛️";
case "Baggersee":
return "🏊";
case "Abbé de l'Epée":
return "🗡";
case "Acacias":
return "🌳";
case "Soleil":
return "🌞";
case "Aeroparc":
return "✈️";
case "Alouettes":
return "🐦";
case "Conseil de l'Europe":
case "Droits de l'Homme":
case "Parlement Européen":
return "🇪🇺";
case "Gallia":
return "🐓";
case "République":
return "🇫🇷";
case "Place d'Islande":
return "🇮🇸";
case "Athènes":
return "🇬🇷";
case "Avenir":
return "🚀";
case "Bâle":
return "🇨🇭";
case "Bois Fleuri":
if (shouldDisplayMay1stCustomEmoji()) {
return "🌳 <:lilyofthevalley:1102362759141785610>";
} else {
return "🌳 🌸";
}
case "Bruxelles":
return "🇧🇪";
case "Bugatti":
return "🏎";
case "Camping":
return "⛺️";
case "Cerisiers":
return "🍒 🌸";
case "Centre Sportif":
return "💪";
case "Château d'Eau":
return "💧";
case "Chopin":
return "🎵";
case "Cimetière":
case "Cimetière Nord":
case "Cimetière Sud":
return "🪦";
case "Copernic":
return "☀️ 🔭";
case "Electricité":
return "⚡️";
case "Gare Centrale":
return "🚄 🚈 🚊 🚌";
case "Hay Ecomusée":
return "🌱 🌍";
case "Hôpital de Hautepierre":
return "🏥";
case "Imprimeurs":
return "🖨";
case "Jardins":
if (shouldDisplayMay1stCustomEmoji()) {
return "🌳 <:lilyofthevalley:1102362759141785610> 🌲";
} else {
return "🌳 ⛲️ 🌲";
}
case "Jardiniers":
if (shouldDisplayMay1stCustomEmoji()) {
return "🧑🌾 <:lilyofthevalley:1102362759141785610>";
} else {
return "🧑🌾";
}
case "Jardin des deux Rives":
if (shouldDisplayMay1stCustomEmoji()) {
return "🇫🇷 🌳 <:lilyofthevalley:1102362759141785610> 🌳 🇩🇪";
} else {
return "🇫🇷 🌳 🇩🇪";
}
case "Jean Monnet":
return "👨🎨";
case "Liberté":
return "🗽";
case "Madrid":
return "🇪🇸";
case "Ankara":
return "🇹🇷";
case "Michel Ange":
return "👨🎨 🇮🇹";
case "Mozart":
return "🎵";
case "Nord":
return "🧭";
case "Paix":
return "🏳";
case "Papeterie":
return "📄";
case "Protection":
return "🛡";
case "Krimmeri Meinau":
return "⚽️";
case "Landsberg":
if (customEmojisAvailable()) {
return "<:landsberg:1103837491720634449>";
} else {
return null;
}
default:
return null;
}
}