Skip to content

Commit

Permalink
less shit
Browse files Browse the repository at this point in the history
  • Loading branch information
mvolfik committed Nov 13, 2024
1 parent 69a63ce commit b9517a9
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions tgbot.deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,25 @@ 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],
)
.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 b9517a9

Please sign in to comment.