4 Commits
2.0.2 ... 2.0.4

Author SHA1 Message Date
Fran Jurmanović
9d137b6b52 fix legica date format 2023-11-01 15:46:04 +01:00
Fran Jurmanović
79110bdb1c version increase 2023-10-21 11:51:25 +02:00
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
3 changed files with 3 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "legica-dana", "name": "legica-dana",
"version": "2.0.2", "version": "2.0.4",
"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"))

View File

@@ -17,7 +17,7 @@ const config: ProjectConfig = {
APP_VERSION: version, APP_VERSION: version,
LEGICA_URL: "https://sib.net.hr/legica-dana", LEGICA_URL: "https://sib.net.hr/legica-dana",
TIMEZONE: process.env.TIMEZONE || "utc", TIMEZONE: process.env.TIMEZONE || "utc",
LEGICA_DATE_FORMAT: process.env.LEGICA_DATE_FORMAT || "DD.MM.YYYY", LEGICA_DATE_FORMAT: process.env.LEGICA_DATE_FORMAT || "D.M.YYYY",
}; };
export { config }; export { config };