diff --git a/src/shared/handlers/JumbleGameHandler.ts b/src/shared/handlers/JumbleGameHandler.ts index 9922a67..37fd2ed 100644 --- a/src/shared/handlers/JumbleGameHandler.ts +++ b/src/shared/handlers/JumbleGameHandler.ts @@ -1,6 +1,5 @@ import { type TranslationKey, - discordTimestampFormats, embedColors, translations, } from "@/utils/contants.js"; @@ -21,6 +20,7 @@ import { type InteractionCollector, type Message, } from "discord.js"; +import { discordTimestampFormats } from "../types/discordTypes.js"; import type { ArtistData } from "../types/musicBrainzTypes.js"; export type JumbleField = "points" | "bestTime" | "plays"; diff --git a/src/shared/types/discordTypes.ts b/src/shared/types/discordTypes.ts index 93287e5..ac6944a 100644 --- a/src/shared/types/discordTypes.ts +++ b/src/shared/types/discordTypes.ts @@ -1,3 +1,13 @@ +export enum discordTimestampFormats { + SHORT_TIME = "t", + LONG_TIME = "T", + SHORT_DATE = "d", + LONG_DATE = "D", + SHORT_DATE_TIME = "f", + LONG_DATE_TIME = "F", + RELATIVE_TIME = "R", +} + export type DiscordUser = { banner: string | null; }; diff --git a/src/utils/contants.ts b/src/utils/contants.ts index cd0ff4f..0236b95 100644 --- a/src/utils/contants.ts +++ b/src/utils/contants.ts @@ -31,16 +31,6 @@ export enum periods { NIGHT = "NIGHT", } -export enum discordTimestampFormats { - SHORT_TIME = "t", - LONG_TIME = "T", - SHORT_DATE = "d", - LONG_DATE = "D", - SHORT_DATE_TIME = "f", - LONG_DATE_TIME = "F", - RELATIVE_TIME = "R", -} - export const urlFixers = { "https://www.youtube.com/shorts/": "https://youtu.be/", "https://www.youtube.com/watch?v=": "https://youtu.be/", @@ -111,56 +101,3 @@ export const expValues = { max: 25, cooldown: 60 * 1000, }; - -export const accents = { - á: "a", - à: "a", - ã: "a", - â: "a", - ä: "a", - Á: "A", - À: "A", - Ã: "A", - Â: "A", - Ä: "A", - é: "e", - è: "e", - ê: "e", - ë: "e", - É: "E", - È: "E", - Ê: "E", - Ë: "E", - í: "i", - ì: "i", - î: "i", - ï: "i", - Í: "I", - Ì: "I", - Î: "I", - Ï: "I", - ó: "o", - ò: "o", - õ: "o", - ô: "o", - ö: "o", - Ó: "O", - Ò: "O", - Õ: "O", - Ô: "O", - Ö: "O", - ú: "u", - ù: "u", - û: "u", - ü: "u", - Ú: "U", - Ù: "U", - Û: "U", - Ü: "U", - ç: "c", - Ç: "C", - ñ: "n", - Ñ: "N", -}; - -export type AccentKey = keyof typeof accents; diff --git a/src/utils/dateFormat.ts b/src/utils/dateFormat.ts index 1fcf225..1939201 100644 --- a/src/utils/dateFormat.ts +++ b/src/utils/dateFormat.ts @@ -1,5 +1,5 @@ +import type { discordTimestampFormats } from "@/shared/types/discordTypes.js"; import dayjs from "dayjs"; -import type { discordTimestampFormats } from "./contants.js"; type DateObject = { day?: number; diff --git a/src/utils/stringFormat.ts b/src/utils/stringFormat.ts index 178962f..209a542 100644 --- a/src/utils/stringFormat.ts +++ b/src/utils/stringFormat.ts @@ -1,7 +1,59 @@ import levenshtein from "js-levenshtein"; -import { type AccentKey, accents } from "./contants.js"; import { shuffle } from "./random.js"; +const accents = { + á: "a", + à: "a", + ã: "a", + â: "a", + ä: "a", + Á: "A", + À: "A", + Ã: "A", + Â: "A", + Ä: "A", + é: "e", + è: "e", + ê: "e", + ë: "e", + É: "E", + È: "E", + Ê: "E", + Ë: "E", + í: "i", + ì: "i", + î: "i", + ï: "i", + Í: "I", + Ì: "I", + Î: "I", + Ï: "I", + ó: "o", + ò: "o", + õ: "o", + ô: "o", + ö: "o", + Ó: "O", + Ò: "O", + Õ: "O", + Ô: "O", + Ö: "O", + ú: "u", + ù: "u", + û: "u", + ü: "u", + Ú: "U", + Ù: "U", + Û: "U", + Ü: "U", + ç: "c", + Ç: "C", + ñ: "n", + Ñ: "N", +}; + +type AccentKey = keyof typeof accents; + export function capitalize(text: string) { return text ?.split(" ")