chore: update dependencies #130

Merged
Anri merged 3 commits from dev into main 2024-04-02 00:11:55 +02:00
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",
"debug": "npx tsnd --respawn ./src/index.ts",
"lint": "npx eslint src",
"format": "npx prettier --check src"
"format-check": "npx prettier --check src",
"format-write": "npx prettier --write src"
},
"repository": {
"type": "git",
@ -16,24 +17,24 @@
"author": "La confrérie du Kassoulait",
"license": "AGPL-3.0-only",
"dependencies": {
"@discord-player/extractor": "^4.4.5",
"@discord-player/extractor": "^4.4.7",
"@discordjs/rest": "^2.2.0",
"@distube/ytdl-core": "^4.13.3",
"@types/sqlite3": "^3.1.11",
"@types/uuid": "^9.0.7",
"discord-player": "^6.6.6",
"@types/uuid": "^9.0.8",
"discord-player": "^6.6.8",
"discord.js": "^14.14.1",
"genius-lyrics": "^4.4.6",
"mediaplex": "^0.0.9",
"sqlite3": "^5.1.6",
"typescript": "^5.3.2",
"sqlite3": "^5.1.7",
"typescript": "^5.4.3",
"uuid": "^9.0.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "~6.13.2",
"@typescript-eslint/parser": "~6.13.2",
"dotenv": "~16.3.1",
"prettier-eslint": "~16.1.2",
"@typescript-eslint/eslint-plugin": "~7.4.0",
"@typescript-eslint/parser": "~7.4.0",
"dotenv": "~16.4.5",
"prettier-eslint": "~16.3.0",
"ts-node-dev": "~2.0.0"
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@ export default {
new SlashCommandBuilder()
.setName(filename.toLowerCase())
.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))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
@ -23,13 +23,13 @@ export default {
.addStringOption((option) =>
option
.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(
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))
.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(
client.locales
.get(client.config.default_lang)
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? ""
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
);
// If a command isn't specified
@ -96,7 +96,7 @@ export default {
// Loads the description
// according to the user's locals
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()
.setName(filename.toLowerCase())
.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))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
@ -28,7 +28,7 @@ export default {
interaction.editReply(
`${loc?.get("c_ping1")}: \
${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()
.setName(filename.toLowerCase())
.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))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`))
@ -22,13 +22,13 @@ export default {
.addStringOption((option) =>
option
.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(
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))
.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(
client.locales
.get(client.config.default_lang)
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? ""
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? "",
)?.value as string;
// If a category isn't specified

View file

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

View file

@ -35,8 +35,8 @@ export default {
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
)
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`)),
),
)
// Romanized
@ -53,8 +53,8 @@ export default {
.setName(loc_default.get(`c_${filename}_opt1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.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);
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;

View file

@ -36,7 +36,7 @@ export default {
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_opt1_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_opt1_desc`))
.setAutocomplete(true)
.setAutocomplete(true),
)
);
},
@ -68,7 +68,7 @@ export default {
}
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;
@ -82,7 +82,7 @@ export default {
if (track) {
const embed = new EmbedBuilder()
.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)
.setURL(track.url)
@ -158,7 +158,7 @@ export default {
const player = useMainPlayer() as Player;
const query = interaction.options.getString(
loc_default?.get(`c_${filename}_opt1_name`) as string,
true
true,
);
const limit_value_discord = 100;
@ -225,7 +225,7 @@ export default {
name,
value: t.url,
};
})
}),
);
}
}

View file

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

View file

@ -27,7 +27,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub1_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub1_desc`) ?? "")
.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
@ -36,7 +36,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub2_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub2_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub2_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub2_desc`)),
)
// Repeat queue
@ -45,7 +45,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub3_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub3_desc`) ?? "")
.setNameLocalizations(getLocalizations(client, `c_${filename}_sub3_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_sub3_desc`)),
)
// Enable autoplay
@ -54,7 +54,7 @@ export default {
.setName(loc_default.get(`c_${filename}_sub4_name`)?.toLowerCase() ?? "")
.setDescription(loc_default.get(`c_${filename}_sub4_desc`) ?? "")
.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() ?? "": {
queue.setRepeatMode(QueueRepeatMode.TRACK);
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() ?? "")
.setDescription(loc_default.get(`c_${filename}_opt1_desc`) ?? "")
.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,
info,
element.option_id,
(element.expiration_date - now) / 1000
(element.expiration_date - now) / 1000,
);
// Update timeout in database

View file

@ -5,7 +5,7 @@ import { readdir } from "fs/promises";
/** Load all the events. */
export default async (client: Client) => {
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) => {
@ -50,7 +50,7 @@ export default async (client: Client) => {
return client.on(event_type, (...args) => {
execute(...args, client);
});
})
}),
);
});
};

View file

@ -40,10 +40,10 @@ export default async (message: Message, client: Client) => {
message_id: string;
channel: TextBasedChannel;
}[] = [],
match
match,
) => {
const [, guild_id, channel_id, message_id] = new RegExp(regex).exec(
match
match,
) as RegExpExecArray;
// If message posted in another guild
@ -62,7 +62,7 @@ export default async (message: Message, client: Client) => {
return data;
},
[]
[],
)
.map(async ({ message_id, channel }) => {
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;
})
}),
)
)
// Remove undefined elements
@ -124,7 +124,7 @@ export default async (message: Message, client: Client) => {
let footer = `Posté le ${showDate(
client.config.default_lang,
loc,
quoted_post?.createdAt as Date
quoted_post?.createdAt as Date,
)}`;
if (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(
client.config.default_lang,
loc,
message.createdAt
message.createdAt,
)}`;
}
@ -157,7 +157,7 @@ export default async (message: Message, client: Client) => {
name: "Message",
value: `${quoted_post?.channel} - [Lien Message](${quoted_post?.url})`,
inline: true,
}
},
);
// 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) => {
// Dossier des modals
const modals_categories = (await readdir(__dirname)).filter(
(element) => !element.endsWith(".js") && !element.endsWith(".ts")
(element) => !element.endsWith(".js") && !element.endsWith(".ts"),
);
await Promise.all(
@ -25,8 +25,8 @@ export default async (client: Client) => {
// Add it to the collection so the interaction will work
client.modals.list.set(modal.data.name, modal);
return modal.data;
})
}),
);
})
}),
);
};

View file

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

View file

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

View file

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

View file

@ -33,10 +33,10 @@ export const loadLocales = async (default_lang: string) => {
.filter((str) => str !== "default")
.map((str) => {
return [str, content[str]];
})
)
}),
),
);
})
}),
);
// 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.
throw new Error(
`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);
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,
function (url: string) {
return `\`${url}\``;
}
},
);
// Fix issues

View file

@ -8,7 +8,7 @@ export const embedListQueue = (
embed: EmbedBuilder,
queue: GuildQueue,
page: number,
local: string
local: string,
) => {
const loc = getLocale(client, local);
const tracks = queue.tracks.toArray();

View file

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

View file

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