chore: update dependencies (#130)
All checks were successful
ci/woodpecker/push/publish Pipeline was successful

- [x] Update dependencies
- [x] Reformat files accordingly to the latest prettier version
- [x] Add a rule to format files (older one was just checking)

Reviewed-on: #130
Co-authored-by: Mylloon <kennel.anri@tutanota.com>
Co-committed-by: Mylloon <kennel.anri@tutanota.com>
This commit is contained in:
Mylloon 2024-04-02 00:11:54 +02:00 committed by Anri Kennel
parent c4acecc0cc
commit da300386ce
Signed by: Forgejo
GPG key ID: E72245C752A07631
30 changed files with 1029 additions and 547 deletions

1279
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,8 @@
"main": "rm -r dist 2> /dev/null; npx tsc && node ./dist/index.js", "main": "rm -r dist 2> /dev/null; npx tsc && node ./dist/index.js",
"debug": "npx tsnd --respawn ./src/index.ts", "debug": "npx tsnd --respawn ./src/index.ts",
"lint": "npx eslint src", "lint": "npx eslint src",
"format": "npx prettier --check src" "format-check": "npx prettier --check src",
"format-write": "npx prettier --write src"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -16,24 +17,24 @@
"author": "La confrérie du Kassoulait", "author": "La confrérie du Kassoulait",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"dependencies": { "dependencies": {
"@discord-player/extractor": "^4.4.5", "@discord-player/extractor": "^4.4.7",
"@discordjs/rest": "^2.2.0", "@discordjs/rest": "^2.2.0",
"@distube/ytdl-core": "^4.13.3", "@distube/ytdl-core": "^4.13.3",
"@types/sqlite3": "^3.1.11", "@types/sqlite3": "^3.1.11",
"@types/uuid": "^9.0.7", "@types/uuid": "^9.0.8",
"discord-player": "^6.6.6", "discord-player": "^6.6.8",
"discord.js": "^14.14.1", "discord.js": "^14.14.1",
"genius-lyrics": "^4.4.6", "genius-lyrics": "^4.4.6",
"mediaplex": "^0.0.9", "mediaplex": "^0.0.9",
"sqlite3": "^5.1.6", "sqlite3": "^5.1.7",
"typescript": "^5.3.2", "typescript": "^5.4.3",
"uuid": "^9.0.1" "uuid": "^9.0.1"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "~6.13.2", "@typescript-eslint/eslint-plugin": "~7.4.0",
"@typescript-eslint/parser": "~6.13.2", "@typescript-eslint/parser": "~7.4.0",
"dotenv": "~16.3.1", "dotenv": "~16.4.5",
"prettier-eslint": "~16.1.2", "prettier-eslint": "~16.3.0",
"ts-node-dev": "~2.0.0" "ts-node-dev": "~2.0.0"
} }
} }

View file

@ -6,7 +6,7 @@ import { getLocale } from "../utils/locales";
export default async (client: Client) => { export default async (client: Client) => {
// Dossier des buttons // Dossier des buttons
const buttons_categories = (await readdir(__dirname)).filter( const buttons_categories = (await readdir(__dirname)).filter(
(element) => !element.endsWith(".js") && !element.endsWith(".ts") (element) => !element.endsWith(".js") && !element.endsWith(".ts"),
); );
await Promise.all( await Promise.all(
@ -26,9 +26,9 @@ export default async (client: Client) => {
// Add it to the collection so the interaction will work // Add it to the collection so the interaction will work
client.buttons.list.set(button.data.name, button); client.buttons.list.set(button.data.name, button);
return button.data; return button.data;
}) }),
); );
}) }),
); );
}; };
@ -43,7 +43,7 @@ export const collect = (
client: Client, client: Client,
interaction: ChatInputCommandInteraction | MessageComponentInteraction, interaction: ChatInputCommandInteraction | MessageComponentInteraction,
id: string, id: string,
deferUpdate = false deferUpdate = false,
) => { ) => {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const button = client.buttons.list.get(id.split("_")[0]); const button = client.buttons.list.get(id.split("_")[0]);

View file

@ -39,7 +39,7 @@ export default {
user, user,
interaction.guildId, interaction.guildId,
page, page,
interaction.locale interaction.locale,
); );
const idPrec = "reminderList-prec_" + uuidv4(); const idPrec = "reminderList-prec_" + uuidv4();
@ -49,13 +49,13 @@ export default {
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idPrec) .setCustomId(idPrec)
.setLabel(loc.get("c_reminder12")) .setLabel(loc.get("c_reminder12"))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idNext) .setCustomId(idNext)
.setLabel(loc.get("c_reminder13")) .setLabel(loc.get("c_reminder13"))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
); );
// Buttons interactions // Buttons interactions

View file

@ -39,7 +39,7 @@ export default {
user, user,
interaction.guildId, interaction.guildId,
page, page,
interaction.locale interaction.locale,
); );
const idPrec = "reminderList-prec_" + uuidv4(); const idPrec = "reminderList-prec_" + uuidv4();
@ -49,13 +49,13 @@ export default {
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idPrec) .setCustomId(idPrec)
.setLabel(loc.get("c_reminder12")) .setLabel(loc.get("c_reminder12"))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idNext) .setCustomId(idNext)
.setLabel(loc.get("c_reminder13")) .setLabel(loc.get("c_reminder13"))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
); );
// Buttons interactions // Buttons interactions

View file

@ -48,14 +48,14 @@ export default {
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idPrec) .setCustomId(idPrec)
.setLabel(loc.get("c_queue8")) .setLabel(loc.get("c_queue8"))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idNext) .setCustomId(idNext)
.setLabel(loc.get("c_queue9")) .setLabel(loc.get("c_queue9"))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) ),
); );
// Buttons interactions // Buttons interactions

View file

@ -48,14 +48,14 @@ export default {
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idPrec) .setCustomId(idPrec)
.setLabel(loc.get("c_queue8")) .setLabel(loc.get("c_queue8"))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idNext) .setCustomId(idNext)
.setLabel(loc.get("c_queue9")) .setLabel(loc.get("c_queue9"))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) ),
); );
// Buttons interactions // Buttons interactions

View file

@ -9,7 +9,7 @@ export default async (client: Client) => {
const rest = new REST({ version: "10" }).setToken(client.token ?? ""); const rest = new REST({ version: "10" }).setToken(client.token ?? "");
const command_categories = (await readdir(__dirname)).filter( const command_categories = (await readdir(__dirname)).filter(
(element) => !element.endsWith(".js") && !element.endsWith(".ts") (element) => !element.endsWith(".js") && !element.endsWith(".ts"),
); );
const commands = ( const commands = (
@ -33,9 +33,9 @@ export default async (client: Client) => {
client.commands.list.set(command.data.name, command); client.commands.list.set(command.data.name, command);
return command; return command;
}) }),
); );
}) }),
) )
).flat(2); ).flat(2);
@ -66,7 +66,7 @@ export default async (client: Client) => {
async (command, guild) => async (command, guild) =>
await rest.put(Routes.applicationGuildCommands(client.user?.id as string, guild), { await rest.put(Routes.applicationGuildCommands(client.user?.id as string, guild), {
body: command, body: command,
}) }),
); );
// Send global commands to Discord // Send global commands to Discord

View file

@ -20,7 +20,7 @@ export default {
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
@ -29,13 +29,13 @@ export default {
.addStringOption((option) => .addStringOption((option) =>
option option
.setName( .setName(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "",
) )
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "",
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
) )
); );
}, },
@ -45,7 +45,7 @@ export default {
const desiredCat = interaction.options.get( const desiredCat = interaction.options.get(
client.locales client.locales
.get(client.config.default_lang) .get(client.config.default_lang)
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "" ?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
)?.value as string; )?.value as string;
// If a category isn't specified // If a category isn't specified
@ -126,13 +126,13 @@ export default {
loc.get("c_archive5") + loc.get("c_archive5") +
" `" + " `" +
catArchivedName + catArchivedName +
"`" "`",
) )
.setDescription( .setDescription(
allChannelDesired allChannelDesired
.map((cgD) => cgD?.name) .map((cgD) => cgD?.name)
.toString() .toString()
.replaceAll(",", "\n") .replaceAll(",", "\n"),
), ),
], ],
}); });

View file

@ -14,7 +14,7 @@ export default {
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
@ -23,13 +23,13 @@ export default {
.addStringOption((option) => .addStringOption((option) =>
option option
.setName( .setName(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "",
) )
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "",
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
) )
); );
}, },
@ -39,7 +39,7 @@ export default {
const desired_command = interaction.options.getString( const desired_command = interaction.options.getString(
client.locales client.locales
.get(client.config.default_lang) .get(client.config.default_lang)
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "" ?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
); );
// If a command isn't specified // If a command isn't specified
@ -96,7 +96,7 @@ export default {
// Loads the description // Loads the description
// according to the user's locals // according to the user's locals
command.data.description_localizations?.[interaction.locale as Locale] ?? command.data.description_localizations?.[interaction.locale as Locale] ??
command.data.description command.data.description,
), ),
], ],
}); });

View file

@ -11,7 +11,7 @@ export default {
return new SlashCommandBuilder() return new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)); .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
@ -28,7 +28,7 @@ export default {
interaction.editReply( interaction.editReply(
`${loc?.get("c_ping1")}: \ `${loc?.get("c_ping1")}: \
${sent.createdTimestamp - interaction.createdTimestamp}ms ${sent.createdTimestamp - interaction.createdTimestamp}ms
${loc?.get("c_ping2")}: ${client.ws.ping}ms.` ${loc?.get("c_ping2")}: ${client.ws.ping}ms.`,
); );
}, },
}; };

View file

@ -13,7 +13,7 @@ export default {
new SlashCommandBuilder() new SlashCommandBuilder()
.setName(filename.toLowerCase()) .setName(filename.toLowerCase())
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? "",
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
@ -22,13 +22,13 @@ export default {
.addStringOption((option) => .addStringOption((option) =>
option option
.setName( .setName(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_name`) ?? "",
) )
.setDescription( .setDescription(
client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "" client.locales.get(client.config.default_lang)?.get(`c_${filename}_opt1_desc`) ?? "",
) )
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
) )
); );
}, },
@ -38,7 +38,7 @@ export default {
const desired_cat = interaction.options.get( const desired_cat = interaction.options.get(
client.locales client.locales
.get(client.config.default_lang) .get(client.config.default_lang)
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "" ?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
)?.value as string; )?.value as string;
// If a category isn't specified // If a category isn't specified

View file

@ -53,11 +53,11 @@ export default {
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "")
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true) getLocalizations(client, `c_${filename}_sub1_opt1_name`, true),
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt1_desc`) getLocalizations(client, `c_${filename}_sub1_opt1_desc`),
) ),
) )
// Specified message (not required) // Specified message (not required)
@ -66,12 +66,12 @@ export default {
.setName(loc_default.get(`c_${filename}_sub1_opt2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_opt2_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub1_opt2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_opt2_desc`) ?? "")
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt2_name`, true) getLocalizations(client, `c_${filename}_sub1_opt2_name`, true),
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt2_desc`) getLocalizations(client, `c_${filename}_sub1_opt2_desc`),
) ),
) ),
) )
// List reminders // List reminders
@ -88,11 +88,11 @@ export default {
.setName(loc_default.get(`c_${filename}_sub2_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub2_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_opt1_desc`) ?? "")
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub2_opt1_name`, true) getLocalizations(client, `c_${filename}_sub2_opt1_name`, true),
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_sub2_opt1_desc`) getLocalizations(client, `c_${filename}_sub2_opt1_desc`),
) ),
) )
// Page // Page
@ -101,12 +101,12 @@ export default {
.setName(loc_default.get(`c_${filename}_sub2_opt2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_opt2_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub2_opt2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_opt2_desc`) ?? "")
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub2_opt2_name`, true) getLocalizations(client, `c_${filename}_sub2_opt2_name`, true),
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_sub2_opt2_desc`) getLocalizations(client, `c_${filename}_sub2_opt2_desc`),
) ),
) ),
) )
// Delete a reminder // Delete a reminder
@ -123,13 +123,13 @@ export default {
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "")
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true) getLocalizations(client, `c_${filename}_sub3_opt1_name`, true),
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_sub3_opt1_desc`) getLocalizations(client, `c_${filename}_sub3_opt1_desc`),
) )
.setRequired(true) .setRequired(true),
) ),
) )
); );
}, },
@ -145,14 +145,14 @@ export default {
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": {
// If time is already renseigned // If time is already renseigned
const time = interaction.options.getString( const time = interaction.options.getString(
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string loc_default?.get(`c_${filename}_sub1_opt1_name`) as string,
); );
if (time != null) { if (time != null) {
// Use the cli because we already have enough data // Use the cli because we already have enough data
return newReminder(client, time, { return newReminder(client, time, {
locale: interaction.locale, locale: interaction.locale,
message: interaction.options.getString( message: interaction.options.getString(
loc_default?.get(`c_${filename}_sub1_opt2_name`) as string loc_default?.get(`c_${filename}_sub1_opt2_name`) as string,
), ),
createdAt: interaction.createdAt.getTime(), createdAt: interaction.createdAt.getTime(),
channelId: interaction.channelId, channelId: interaction.channelId,
@ -162,7 +162,7 @@ export default {
interaction.reply({ interaction.reply({
content: msg as string, content: msg as string,
ephemeral: true, ephemeral: true,
}) }),
); );
} else { } else {
// Show modal to user to get at least the time // Show modal to user to get at least the time
@ -186,7 +186,7 @@ export default {
modal.addComponents( modal.addComponents(
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(timeGUI), new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(timeGUI),
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(messageGUI) new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(messageGUI),
); );
return interaction.showModal(modal); return interaction.showModal(modal);
@ -196,7 +196,7 @@ export default {
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": {
// Which user to show // Which user to show
let user = interaction.options.getUser( let user = interaction.options.getUser(
loc_default?.get(`c_${filename}_sub2_opt1_name`) as string loc_default?.get(`c_${filename}_sub2_opt1_name`) as string,
); );
if (user == null) { if (user == null) {
user = interaction.user; user = interaction.user;
@ -204,14 +204,14 @@ export default {
const page = const page =
interaction.options.getInteger( interaction.options.getInteger(
loc_default?.get(`c_${filename}_sub2_opt2_name`) as string loc_default?.get(`c_${filename}_sub2_opt2_name`) as string,
) ?? 1; ) ?? 1;
const list = await embedListReminders( const list = await embedListReminders(
client, client,
user, user,
interaction.guildId, interaction.guildId,
page, page,
interaction.locale interaction.locale,
); );
const idPrec = "reminderList-prec_" + uuidv4(); const idPrec = "reminderList-prec_" + uuidv4();
@ -221,13 +221,13 @@ export default {
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idPrec) .setCustomId(idPrec)
.setLabel(loc.get(`c_${filename}12`)) .setLabel(loc.get(`c_${filename}12`))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idNext) .setCustomId(idNext)
.setLabel(loc.get(`c_${filename}13`)) .setLabel(loc.get(`c_${filename}13`))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
); );
// Buttons interactions // Buttons interactions
@ -243,7 +243,7 @@ export default {
// Delete a reminder // Delete a reminder
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": {
const id = interaction.options.getInteger( const id = interaction.options.getInteger(
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string loc_default?.get(`c_${filename}_sub3_opt1_name`) as string,
); );
if (id === null) { if (id === null) {
return interaction.reply({ return interaction.reply({
@ -271,7 +271,7 @@ export default {
interaction.reply({ interaction.reply({
content: `Reminder **#${id}** supprimé !`, content: `Reminder **#${id}** supprimé !`,
ephemeral: true, ephemeral: true,
}) }),
); );
} }
default: { default: {

View file

@ -35,8 +35,8 @@ export default {
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
) ),
) )
// Romanized // Romanized
@ -53,8 +53,8 @@ export default {
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
) ),
) )
); );
}, },
@ -66,7 +66,7 @@ export default {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
let request = interaction.options.getString( let request = interaction.options.getString(
loc_default?.get(`c_${filename}_opt1_name`) as string loc_default?.get(`c_${filename}_opt1_name`) as string,
); );
let data = null; let data = null;

View file

@ -36,7 +36,7 @@ export default {
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
.setAutocomplete(true) .setAutocomplete(true),
) )
); );
}, },
@ -68,7 +68,7 @@ export default {
} }
const query = interaction.options.getString( const query = interaction.options.getString(
loc_default?.get(`c_${filename}_opt1_name`) as string loc_default?.get(`c_${filename}_opt1_name`) as string,
); );
const player = useMainPlayer() as Player; const player = useMainPlayer() as Player;
@ -82,7 +82,7 @@ export default {
if (track) { if (track) {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setDescription( .setDescription(
`${queue.node.createProgressBar()}\n\n${loc.get("c_play8")} ${track.requestedBy}` `${queue.node.createProgressBar()}\n\n${loc.get("c_play8")} ${track.requestedBy}`,
) )
.setTitle(track.title + " • " + track.author) .setTitle(track.title + " • " + track.author)
.setURL(track.url) .setURL(track.url)
@ -158,7 +158,7 @@ export default {
const player = useMainPlayer() as Player; const player = useMainPlayer() as Player;
const query = interaction.options.getString( const query = interaction.options.getString(
loc_default?.get(`c_${filename}_opt1_name`) as string, loc_default?.get(`c_${filename}_opt1_name`) as string,
true true,
); );
const limit_value_discord = 100; const limit_value_discord = 100;
@ -225,7 +225,7 @@ export default {
name, name,
value: t.url, value: t.url,
}; };
}) }),
); );
} }
} }

View file

@ -45,12 +45,12 @@ export default {
.setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_opt1_desc`) ?? "")
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt1_name`, true) getLocalizations(client, `c_${filename}_sub1_opt1_name`, true),
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_sub1_opt1_desc`) getLocalizations(client, `c_${filename}_sub1_opt1_desc`),
) ),
) ),
) )
// Shuffle Queue // Shuffle Queue
@ -59,7 +59,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
) )
// Remove <ID> // Remove <ID>
@ -77,13 +77,13 @@ export default {
.setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_opt1_desc`) ?? "")
.setNameLocalizations( .setNameLocalizations(
getLocalizations(client, `c_${filename}_sub3_opt1_name`, true) getLocalizations(client, `c_${filename}_sub3_opt1_name`, true),
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_sub3_opt1_desc`) getLocalizations(client, `c_${filename}_sub3_opt1_desc`),
) )
.setRequired(true) .setRequired(true),
) ),
) )
); );
}, },
@ -105,7 +105,7 @@ export default {
case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "": {
const page = const page =
interaction.options.getNumber( interaction.options.getNumber(
loc_default?.get(`c_${filename}_sub1_opt1_name`) as string loc_default?.get(`c_${filename}_sub1_opt1_name`) as string,
) ?? 1; ) ?? 1;
embedListQueue(client, embed, queue, page, interaction.locale); embedListQueue(client, embed, queue, page, interaction.locale);
@ -118,14 +118,14 @@ export default {
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idPrec) .setCustomId(idPrec)
.setLabel(loc.get(`c_${filename}8`)) .setLabel(loc.get(`c_${filename}8`))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) )
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(idNext) .setCustomId(idNext)
.setLabel(loc.get(`c_${filename}9`)) .setLabel(loc.get(`c_${filename}9`))
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary),
) ),
); );
// Buttons interactions // Buttons interactions
@ -146,14 +146,14 @@ export default {
// Remove <ID> // Remove <ID>
case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "": {
const id = interaction.options.getNumber( const id = interaction.options.getNumber(
loc_default?.get(`c_${filename}_sub3_opt1_name`) as string loc_default?.get(`c_${filename}_sub3_opt1_name`) as string,
) as number; ) as number;
const track = queue.removeTrack(id - 1); const track = queue.removeTrack(id - 1);
if (track) { if (track) {
embed.setDescription( embed.setDescription(
`${loc.get("c_queue4")} #${id} \`${track.title}\` ${loc.get("c_queue5")}` `${loc.get("c_queue4")} #${id} \`${track.title}\` ${loc.get("c_queue5")}`,
); );
} else { } else {
embed.setDescription(loc.get("c_queue6")); embed.setDescription(loc.get("c_queue6"));

View file

@ -27,7 +27,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub1_desc`)),
) )
// Repeat current track // Repeat current track
@ -36,7 +36,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
) )
// Repeat queue // Repeat queue
@ -45,7 +45,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)),
) )
// Enable autoplay // Enable autoplay
@ -54,7 +54,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub4_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_sub4_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub4_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_sub4_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub4_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_sub4_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub4_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub4_desc`)),
) )
); );
}, },
@ -91,7 +91,7 @@ export default {
case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": { case loc_default?.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "": {
queue.setRepeatMode(QueueRepeatMode.TRACK); queue.setRepeatMode(QueueRepeatMode.TRACK);
return interaction.reply( return interaction.reply(
`${loc.get("c_repeat5")} ${queue.history.currentTrack?.title} ${loc.get("c_repeat6")}.` `${loc.get("c_repeat5")} ${queue.history.currentTrack?.title} ${loc.get("c_repeat6")}.`,
); );
} }
} }

View file

@ -27,7 +27,7 @@ export default {
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "") .setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "") .setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true)) .setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
) )
); );
}, },

View file

@ -55,7 +55,7 @@ export default async (client: Client) => {
client, client,
info, info,
element.option_id, element.option_id,
(element.expiration_date - now) / 1000 (element.expiration_date - now) / 1000,
); );
// Update timeout in database // Update timeout in database

View file

@ -5,7 +5,7 @@ import { readdir } from "fs/promises";
/** Load all the events. */ /** Load all the events. */
export default async (client: Client) => { export default async (client: Client) => {
const events_categories = (await readdir(__dirname)).filter( const events_categories = (await readdir(__dirname)).filter(
(element) => !element.endsWith(".js") && !element.endsWith(".ts") (element) => !element.endsWith(".js") && !element.endsWith(".ts"),
); );
events_categories.forEach(async (event_category) => { events_categories.forEach(async (event_category) => {
@ -50,7 +50,7 @@ export default async (client: Client) => {
return client.on(event_type, (...args) => { return client.on(event_type, (...args) => {
execute(...args, client); execute(...args, client);
}); });
}) }),
); );
}); });
}; };

View file

@ -40,10 +40,10 @@ export default async (message: Message, client: Client) => {
message_id: string; message_id: string;
channel: TextBasedChannel; channel: TextBasedChannel;
}[] = [], }[] = [],
match match,
) => { ) => {
const [, guild_id, channel_id, message_id] = new RegExp(regex).exec( const [, guild_id, channel_id, message_id] = new RegExp(regex).exec(
match match,
) as RegExpExecArray; ) as RegExpExecArray;
// If message posted in another guild // If message posted in another guild
@ -62,7 +62,7 @@ export default async (message: Message, client: Client) => {
return data; return data;
}, },
[] [],
) )
.map(async ({ message_id, channel }) => { .map(async ({ message_id, channel }) => {
const quoted_message = await channel.messages.fetch(message_id).catch(() => undefined); const quoted_message = await channel.messages.fetch(message_id).catch(() => undefined);
@ -76,7 +76,7 @@ export default async (message: Message, client: Client) => {
} }
return quoted_message; return quoted_message;
}) }),
) )
) )
// Remove undefined elements // Remove undefined elements
@ -124,7 +124,7 @@ export default async (message: Message, client: Client) => {
let footer = `Posté le ${showDate( let footer = `Posté le ${showDate(
client.config.default_lang, client.config.default_lang,
loc, loc,
quoted_post?.createdAt as Date quoted_post?.createdAt as Date,
)}`; )}`;
if (quoted_post?.editedAt) { if (quoted_post?.editedAt) {
footer += ` et modifié le ${showDate(client.config.default_lang, loc, quoted_post.editedAt)}`; footer += ` et modifié le ${showDate(client.config.default_lang, loc, quoted_post.editedAt)}`;
@ -137,7 +137,7 @@ export default async (message: Message, client: Client) => {
footer += `\nCité par ${userWithNickname(message.member as GuildMember) ?? "?"} le ${showDate( footer += `\nCité par ${userWithNickname(message.member as GuildMember) ?? "?"} le ${showDate(
client.config.default_lang, client.config.default_lang,
loc, loc,
message.createdAt message.createdAt,
)}`; )}`;
} }
@ -157,7 +157,7 @@ export default async (message: Message, client: Client) => {
name: "Message", name: "Message",
value: `${quoted_post?.channel} - [Lien Message](${quoted_post?.url})`, value: `${quoted_post?.channel} - [Lien Message](${quoted_post?.url})`,
inline: true, inline: true,
} },
); );
// Delete source message if no content when removing links // Delete source message if no content when removing links

View file

@ -5,7 +5,7 @@ import { removeExtension } from "../utils/misc";
export default async (client: Client) => { export default async (client: Client) => {
// Dossier des modals // Dossier des modals
const modals_categories = (await readdir(__dirname)).filter( const modals_categories = (await readdir(__dirname)).filter(
(element) => !element.endsWith(".js") && !element.endsWith(".ts") (element) => !element.endsWith(".js") && !element.endsWith(".ts"),
); );
await Promise.all( await Promise.all(
@ -25,8 +25,8 @@ export default async (client: Client) => {
// Add it to the collection so the interaction will work // Add it to the collection so the interaction will work
client.modals.list.set(modal.data.name, modal); client.modals.list.set(modal.data.name, modal);
return modal.data; return modal.data;
}) }),
); );
}) }),
); );
}; };

View file

@ -18,6 +18,6 @@ export default {
interaction.reply({ interaction.reply({
content: msg as string, content: msg as string,
ephemeral: true, ephemeral: true,
}) }),
), ),
}; };

View file

@ -57,7 +57,7 @@ declare module "discord.js" {
/** How the button interact */ /** How the button interact */
interaction: ( interaction: (
interaction: MessageComponentInteraction, interaction: MessageComponentInteraction,
client: Client client: Client,
) => Promise<InteractionUpdateOptions>; ) => Promise<InteractionUpdateOptions>;
} }
>; >;

View file

@ -88,6 +88,6 @@ const initDatabase = (db: Database) => {
guild_id TEXT, \ guild_id TEXT, \
locale TEXT, \ locale TEXT, \
timeout_id TEXT \ timeout_id TEXT \
);" );",
); );
}; };

View file

@ -33,10 +33,10 @@ export const loadLocales = async (default_lang: string) => {
.filter((str) => str !== "default") .filter((str) => str !== "default")
.map((str) => { .map((str) => {
return [str, content[str]]; return [str, content[str]];
}) }),
) ),
); );
}) }),
); );
// Check locales sanity // Check locales sanity
@ -130,7 +130,7 @@ const checkLocales = async (locales: Map<string, Map<string, string>>, default_l
// and the security is poor, but it's better than nothing. // and the security is poor, but it's better than nothing.
throw new Error( throw new Error(
`The default locale (${default_lang} = ${default_lang_size}) isn't complete ` + `The default locale (${default_lang} = ${default_lang_size}) isn't complete ` +
`(${max_size_name} = ${max_size}).` `(${max_size_name} = ${max_size}).`,
); );
} }
@ -167,7 +167,7 @@ const checkLocales = async (locales: Map<string, Map<string, string>>, default_l
const padding = " ".repeat(lang.length === 5 ? 1 : 4); const padding = " ".repeat(lang.length === 5 ? 1 : 4);
console.log( console.log(
`${padding}${lang} | ${color()}${blocks}\x1b[0m${blank} | ${percentage.toPrecision(3)}%` `${padding}${lang} | ${color()}${blocks}\x1b[0m${blank} | ${percentage.toPrecision(3)}%`,
); );
}); });
}; };

View file

@ -94,7 +94,7 @@ export const cleanCodeBlock = (text: string) => {
/(http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)/g, /(http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)/g,
function (url: string) { function (url: string) {
return `\`${url}\``; return `\`${url}\``;
} },
); );
// Fix issues // Fix issues

View file

@ -8,7 +8,7 @@ export const embedListQueue = (
embed: EmbedBuilder, embed: EmbedBuilder,
queue: GuildQueue, queue: GuildQueue,
page: number, page: number,
local: string local: string,
) => { ) => {
const loc = getLocale(client, local); const loc = getLocale(client, local);
const tracks = queue.tracks.toArray(); const tracks = queue.tracks.toArray();
@ -29,8 +29,8 @@ export const embedListQueue = (
const name = now_playing const name = now_playing
? loc.get("c_queue10") ? loc.get("c_queue10")
: (idx == 1 && page == 1) || (idx == 0 && page > 1) : (idx == 1 && page == 1) || (idx == 0 && page > 1)
? loc.get("c_queue11") ? loc.get("c_queue11")
: "\u200b"; : "\u200b";
const idx_track = now_playing ? "" : `${idx + limit_fields * (page - 1)}. `; const idx_track = now_playing ? "" : `${idx + limit_fields * (page - 1)}. `;
embed.addFields({ embed.addFields({
name, name,

View file

@ -92,7 +92,7 @@ export const newReminder = async (client: Client, time: string, info: infoRemind
// Send confirmation to user // Send confirmation to user
const loc = getLocale(client, info.locale); const loc = getLocale(client, info.locale);
ok(`${loc.get("c_reminder1")} ${data.time}.`); ok(`${loc.get("c_reminder1")} ${data.time}.`);
} },
); );
}); });
@ -117,7 +117,7 @@ export const deleteReminder = (client: Client, createdAt: string, userId: string
// Send confirmation to user // Send confirmation to user
ok(true); ok(true);
} },
); );
}); });
}; };
@ -200,7 +200,7 @@ export const setTimeoutReminder = (
client: Client, client: Client,
info: infoReminder, info: infoReminder,
option: OptionReminder, option: OptionReminder,
timeout: number timeout: number,
) => { ) => {
return Number( return Number(
setTimeout(() => { setTimeout(() => {
@ -211,7 +211,7 @@ export const setTimeoutReminder = (
sendReminder(client, info, option); sendReminder(client, info, option);
}); });
}, timeout * 1000) }, timeout * 1000),
); );
}; };
@ -226,7 +226,7 @@ export const checkOwnershipReminder = async (
client: Client, client: Client,
id: number, id: number,
userId: string, userId: string,
guildId: string guildId: string,
) => { ) => {
type returnData = { [key: string]: number }; type returnData = { [key: string]: number };
@ -247,7 +247,7 @@ export const checkOwnershipReminder = async (
// Send all the current reminders // Send all the current reminders
ok(row[0]); ok(row[0]);
} },
); );
})) as returnData; })) as returnData;
return Object.keys(data).map((key) => data[key])[0] === 0 ? true : false; return Object.keys(data).map((key) => data[key])[0] === 0 ? true : false;
@ -272,7 +272,7 @@ export const getReminderInfo = async (client: Client, id: number) => {
// Send all the current reminders // Send all the current reminders
ok(row[0]); ok(row[0]);
} },
); );
})) as dbReminder; })) as dbReminder;
}; };
@ -316,7 +316,7 @@ export const updateReminder = (client: Client, data: dbReminder) => {
} }
ok(true); ok(true);
} },
); );
}); });
}; };
@ -342,7 +342,7 @@ const listReminders = async (client: Client, userId: string, guildId: string | n
// Send all the current reminders // Send all the current reminders
ok(row); ok(row);
} },
); );
})) as dbReminder[]; })) as dbReminder[];
}; };
@ -361,7 +361,7 @@ export const embedListReminders = async (
user: User, user: User,
guildId: string | null, guildId: string | null,
page: number, page: number,
local: string local: string,
) => { ) => {
const loc = getLocale(client, local); const loc = getLocale(client, local);
const reminders = await listReminders(client, user.id, guildId); const reminders = await listReminders(client, user.id, guildId);
@ -376,7 +376,7 @@ export const embedListReminders = async (
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(Colors.DarkGrey) .setColor(Colors.DarkGrey)
.setDescription( .setDescription(
`${loc.get("c_reminder5")} ${user}${loc.get("c_reminder6")} ${page}/${pageMax}` `${loc.get("c_reminder5")} ${user}${loc.get("c_reminder6")} ${page}/${pageMax}`,
) )
.setThumbnail(user.displayAvatarURL()); .setThumbnail(user.displayAvatarURL());
@ -396,7 +396,7 @@ export const embedListReminders = async (
name: `#${remind.id}${loc.get("c_reminder9")} ${showDate( name: `#${remind.id}${loc.get("c_reminder9")} ${showDate(
local, local,
loc, loc,
new Date(Number(remind.creation_date)) new Date(Number(remind.creation_date)),
)}\n${expiration}`, )}\n${expiration}`,
value: text, value: text,
inline: false, inline: false,

View file

@ -31,7 +31,7 @@ export const strToSeconds = (time: string) => {
TimeSecond[TimeSecond.Hour] TimeSecond[TimeSecond.Hour]
}>[0-9]+(?=[h]))|(?<${TimeSecond[TimeSecond.Minute]}>[0-9]+(?=[m]))|(?<${ }>[0-9]+(?=[h]))|(?<${TimeSecond[TimeSecond.Minute]}>[0-9]+(?=[m]))|(?<${
TimeSecond[TimeSecond.Second] TimeSecond[TimeSecond.Second]
}>[0-9]+(?=[s]?))` }>[0-9]+(?=[s]?))`,
); );
const data = Object.assign({}, regex.exec(time)?.groups); const data = Object.assign({}, regex.exec(time)?.groups);