Skip to content

Commit a7a3e8c

Browse files
committed
detašované pracoviště
1 parent 0d9e000 commit a7a3e8c

File tree

1 file changed

+42
-37
lines changed

1 file changed

+42
-37
lines changed

tgbot.deno.ts

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ let tempDir = "";
105105
const contentTypes = new Map<string, string>();
106106
const runningProcesses = new Map<string, Deno.Process>();
107107

108-
const origin = { lat: 50.1005803, lon: 14.3954325 };
108+
const origins = [
109+
{ lat: 50.1005803, lon: 14.3954325 },
110+
{ lat: 55.6865969, lon: 12.5759392 },
111+
];
109112
async function postGeohash() {
110113
const upcoming = new Date();
111114
upcoming.setHours(6);
@@ -116,45 +119,47 @@ async function postGeohash() {
116119
upcoming.setDate(upcoming.getDate() + 1);
117120
}
118121

119-
await new Promise((resolve) =>
120-
setTimeout(resolve, upcoming.getTime() - now.getTime())
121-
);
122122

123-
const geoHash = await geohash(new Date(), origin);
124-
const a = zoomForPoints({
125-
MinY: Math.min(origin.lat, geoHash.lat),
126-
MinX: Math.min(origin.lon, geoHash.lon),
127-
MaxY: Math.max(origin.lat, geoHash.lat),
128-
MaxX: Math.max(origin.lon, geoHash.lon),
129-
});
130-
const meta = {
131-
point: geoHash,
132-
...a,
133-
};
134-
135-
const text = `[ ](${
136-
getImageForPoint(
137-
meta,
138-
)
139-
})Today's geohash is at [${
140-
geoHash.lat
141-
.toFixed(5)
142-
.replace(".", "\\.")
143-
} ${
144-
geoHash.lon
145-
.toFixed(5)
146-
.replace(".", "\\.")
147-
}](${
148-
getUrlForPoint(
149-
meta,
150-
)
151-
})\\.\nPlease refer to xkcd\\.com/426/ for further steps\\.`;
123+
for (const origin of origins) {
124+
const geoHash = await geohash(new Date(), origin);
125+
const a = zoomForPoints({
126+
MinY: Math.min(origin.lat, geoHash.lat),
127+
MinX: Math.min(origin.lon, geoHash.lon),
128+
MaxY: Math.max(origin.lat, geoHash.lat),
129+
MaxX: Math.max(origin.lon, geoHash.lon),
130+
});
131+
const meta = {
132+
point: geoHash,
133+
...a,
134+
};
135+
136+
const text = `[ ](${
137+
getImageForPoint(
138+
meta,
139+
)
140+
})Today's geohash is at [${
141+
geoHash.lat
142+
.toFixed(5)
143+
.replace(".", "\\.")
144+
} ${
145+
geoHash.lon
146+
.toFixed(5)
147+
.replace(".", "\\.")
148+
}](${
149+
getUrlForPoint(
150+
meta,
151+
)
152+
})\\.\nPlease refer to xkcd\\.com/426/ for further steps\\.`;
152153

153-
await tgCall({
154-
text,
155-
parse_mode: "MarkdownV2",
156-
});
154+
await tgCall({
155+
text,
156+
parse_mode: "MarkdownV2",
157+
});
158+
}
157159

160+
await new Promise((resolve) =>
161+
setTimeout(resolve, upcoming.getTime() - now.getTime())
162+
);
158163
await domeny();
159164

160165
setTimeout(postGeohash, 1000 * 60 * 60 * 2);

0 commit comments

Comments
 (0)