2 Commits
2.0.2 ... 2.0.3

Author SHA1 Message Date
Fran Jurmanović
0d2fba3883 fix regex not working everytime 2023-10-21 11:50:47 +02:00
Fran Jurmanović
77aa924161 increase version 2023-10-21 11:50:23 +02:00
2 changed files with 2 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "legica-dana", "name": "legica-dana",
"version": "2.0.2", "version": "2.0.3",
"main": "src/app.ts", "main": "src/app.ts",
"scripts": { "scripts": {
"start": "bun src/app.ts" "start": "bun src/app.ts"

View File

@@ -6,8 +6,6 @@ import { Client, MessageEmbed, TextChannel } from "discord.js";
dayjs.extend(customParseFormat); dayjs.extend(customParseFormat);
const dateRegex = /\d{1,2}.\d{1,2}.\d{4}/g;
export async function sendDiscordMessage( export async function sendDiscordMessage(
client: Client, client: Client,
url: string, url: string,
@@ -17,6 +15,7 @@ export async function sendDiscordMessage(
const { img, title } = await getImgTitle(url); const { img, title } = await getImgTitle(url);
if (dateCheck) { if (dateCheck) {
const dateRegex = /\d{1,2}.\d{1,2}.\d{4}/g;
const date = dateRegex.exec(title)?.[0]; const date = dateRegex.exec(title)?.[0];
const dayjsDate = dayjs(date, config.LEGICA_DATE_FORMAT); const dayjsDate = dayjs(date, config.LEGICA_DATE_FORMAT);
if (!dateCheck.isSame(dayjsDate, "D")) if (!dateCheck.isSame(dayjsDate, "D"))