Skip to content

Commit

Permalink
less shit
Browse files Browse the repository at this point in the history
  • Loading branch information
mvolfik committed Nov 10, 2024
1 parent 69a63ce commit d477411
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions tgbot.deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,26 @@ async function domeny() {
const resp = await fetch(
"https://auctions-master.nic.cz/share/new_auctions.json",
);
const list = await resp.json();
let list = await resp.json();

const x = list
list = list
.filter(
(a) =>
a.auction_from.split("T")[0] === new Date().toISOString().split("T")[0],
a.auction_from.split("T")[0] ===
new Date("2024-11-11").toISOString().split("T")[0],
)
.map((x) => x.item_title)
.map((x) => x.replaceAll(/[_*[\\\]()~`>#+=|{}.!/-]/g, ($) => `\\${$}`));
x.sort();
x.sort((a, b) => a.length - b.length);
while (x.length > 0) {
const chunk = x.splice(0, 50);
const webArchiveLinks = chunk.map(
(l) => `[${l}](https://web.archive.org/web/${l})`,
);
.map((x) => x.item_title);
list.sort();
list.sort((a, b) => a.length - b.length);
list = list.filter((x) => x.length <= 8).concat(list.slice(-20));
console.log(list);
while (list.length > 0) {
const chunk = list.splice(0, 50);
const webArchiveLinks = chunk
.map((x) => x.replaceAll(/[_*[\\\]()~`>#+=|{}.!/-]/g, ($) => `\\${$}`))
.map(
(l) => `[${l}](https://web.archive.org/web/${l})`,
);
await tgCall({
text: webArchiveLinks.join("\n"),
parse_mode: "MarkdownV2",
Expand Down

0 comments on commit d477411

Please sign in to comment.