chore: upgrade dependencies (#213)
Some checks failed
Publish latest version / build (push) Failing after 50s

Reviewed-on: #213
Co-authored-by: Mylloon <kennel.anri@tutanota.com>
Co-committed-by: Mylloon <kennel.anri@tutanota.com>
This commit is contained in:
Mylloon 2025-01-02 22:36:14 +01:00 committed by Mylloon
parent f851ac44f6
commit 75ef50c85c
Signed by: Forgejo
GPG key ID: E72245C752A07631
17 changed files with 1847 additions and 438 deletions

2144
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -19,20 +19,19 @@
"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.5.1", "@discord-player/extractor": "^7.0.0",
"@discordjs/rest": "^2.4.0", "@discordjs/rest": "^2.4.2",
"discord-player": "^6.7.1", "discord-player": "^7.0.0",
"discord-player-youtubei": "^1.3.5", "discord-player-youtubei": "^1.3.7",
"discord.js": "^14.16.3", "discord.js": "^14.17.2",
"mediaplex": "^1.0.0",
"moment-timezone": "^0.5.46", "moment-timezone": "^0.5.46",
"sqlite3": "^5.1.7", "sqlite3": "^5.1.7",
"typescript": "^5.7.2", "typescript": "^5.7.2",
"uuid": "^11.0.3" "uuid": "^11.0.3"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "~8.17.0", "@typescript-eslint/eslint-plugin": "~8.19.0",
"@typescript-eslint/parser": "~8.17.0", "@typescript-eslint/parser": "~8.19.0",
"dotenv": "~16.4.7", "dotenv": "~16.4.7",
"prettier-eslint": "~16.3.0", "prettier-eslint": "~16.3.0",
"ts-node-dev": "~2.0.0", "ts-node-dev": "~2.0.0",

View file

@ -5,6 +5,7 @@ import {
Client, Client,
Message, Message,
MessageComponentInteraction, MessageComponentInteraction,
MessageFlags,
} from "discord.js"; } from "discord.js";
import { getLocale } from "../utils/locales"; import { getLocale } from "../utils/locales";
@ -58,7 +59,7 @@ export const collect = (
if (!button) { if (!button) {
interaction.reply({ interaction.reply({
content: loc.get("e_interacreate_no_button"), content: loc.get("e_interacreate_no_button"),
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }

View file

@ -5,6 +5,7 @@ import {
Colors, Colors,
CommandInteraction, CommandInteraction,
EmbedBuilder, EmbedBuilder,
MessageFlags,
NonThreadGuildBasedChannel, NonThreadGuildBasedChannel,
} from "discord.js"; } from "discord.js";
import "../../modules/string"; import "../../modules/string";
@ -66,7 +67,7 @@ export default {
// Category doesn't exist or is not included // Category doesn't exist or is not included
return interaction.reply({ return interaction.reply({
content: `${loc.get("c_archive3")} \`${desiredCat}\``, content: `${loc.get("c_archive3")} \`${desiredCat}\``,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }

View file

@ -5,6 +5,7 @@ import {
Client, Client,
Colors, Colors,
EmbedBuilder, EmbedBuilder,
MessageFlags,
} from "discord.js"; } from "discord.js";
import "../../modules/string"; import "../../modules/string";
import { getLocale, getLocalizations } from "../../utils/locales"; import { getLocale, getLocalizations } from "../../utils/locales";
@ -110,13 +111,13 @@ export default {
const command = NameNotLocalized(client, possible_command); const command = NameNotLocalized(client, possible_command);
if (!command) { if (!command) {
return interaction.reply({ content: error, ephemeral: true }); return interaction.reply({ content: error, flags: [MessageFlags.Ephemeral] });
} }
const scope = client.commands.list.get(command.name)?.scope(); const scope = client.commands.list.get(command.name)?.scope();
if (scope!.length > 0 && scope?.find((id) => id === interaction.guildId) === undefined) { if (scope!.length > 0 && scope?.find((id) => id === interaction.guildId) === undefined) {
// Command not available for the current guild // Command not available for the current guild
return interaction.reply({ content: error, ephemeral: true }); return interaction.reply({ content: error, flags: [MessageFlags.Ephemeral] });
} }
let subcommand = undefined; let subcommand = undefined;
@ -128,7 +129,7 @@ export default {
if (!command || subcommand === undefined) { if (!command || subcommand === undefined) {
// Sub/Command don't exist // Sub/Command don't exist
return interaction.reply({ content: error, ephemeral: true }); return interaction.reply({ content: error, flags: [MessageFlags.Ephemeral] });
} }
// Loads the data according to the user's locals // Loads the data according to the user's locals

View file

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from "@discordjs/builders"; import { SlashCommandBuilder } from "@discordjs/builders";
import { ChatInputCommandInteraction, Client, Message } from "discord.js"; import { ChatInputCommandInteraction, Client } from "discord.js";
import { getLocale, getLocalizations } from "../../utils/locales"; import { getLocale, getLocalizations } from "../../utils/locales";
import { getFilename } from "../../utils/misc"; import { getFilename } from "../../utils/misc";
@ -18,14 +18,14 @@ export default {
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const sent = (await interaction.reply({ const sent = await interaction.reply({
content: "Pinging...", content: "Pinging...",
fetchReply: true, withResponse: true,
})) as Message; });
interaction.editReply( interaction.editReply(
`${loc?.get("c_ping1")}: \ `${loc?.get("c_ping1")}: \
${sent.createdTimestamp - interaction.createdTimestamp}ms ${sent.resource!.message!.createdTimestamp - interaction.createdTimestamp}ms
${loc?.get("c_ping2")}: ${client.ws.ping}ms.`, ${loc?.get("c_ping2")}: ${client.ws.ping}ms.`,
); );
}, },

View file

@ -1,5 +1,12 @@
import { SlashCommandBuilder } from "@discordjs/builders"; import { SlashCommandBuilder } from "@discordjs/builders";
import { ChannelType, Client, Colors, CommandInteraction, EmbedBuilder } from "discord.js"; import {
ChannelType,
Client,
Colors,
CommandInteraction,
EmbedBuilder,
MessageFlags,
} from "discord.js";
import "../../modules/string"; import "../../modules/string";
import { getLocale, getLocalizations } from "../../utils/locales"; import { getLocale, getLocalizations } from "../../utils/locales";
import { getFilename } from "../../utils/misc"; import { getFilename } from "../../utils/misc";
@ -59,7 +66,7 @@ export default {
// Category doesn't exist or is not allowed // Category doesn't exist or is not allowed
return interaction.reply({ return interaction.reply({
content: `${loc.get("c_prep3")} \`${desired_cat}\``, content: `${loc.get("c_prep3")} \`${desired_cat}\``,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }

View file

@ -5,6 +5,7 @@ import {
ButtonStyle, ButtonStyle,
ChatInputCommandInteraction, ChatInputCommandInteraction,
Client, Client,
MessageFlags,
ModalBuilder, ModalBuilder,
TextInputBuilder, TextInputBuilder,
TextInputStyle, TextInputStyle,
@ -162,13 +163,13 @@ export default {
.then((msg) => .then((msg) =>
interaction.reply({ interaction.reply({
content: msg as string, content: msg as string,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}), }),
) )
.catch((err) => { .catch((err) => {
interaction.reply({ interaction.reply({
content: err, content: err,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
}); });
} else { } else {
@ -233,16 +234,16 @@ export default {
.setStyle(ButtonStyle.Primary), .setStyle(ButtonStyle.Primary),
); );
const message = await interaction.reply({ const callback = await interaction.reply({
ephemeral: true, flags: [MessageFlags.Ephemeral],
embeds: [list], embeds: [list],
components: [row], components: [row],
fetchReply: true, withResponse: true,
}); });
// Buttons interactions // Buttons interactions
collect(client, interaction, idPrec, message); collect(client, interaction, idPrec, callback.resource!.message!);
collect(client, interaction, idNext, message); collect(client, interaction, idNext, callback.resource!.message!);
return; return;
} }
@ -254,7 +255,7 @@ export default {
if (id === null) { if (id === null) {
return interaction.reply({ return interaction.reply({
content: loc.get(`c_${filename}2`), content: loc.get(`c_${filename}2`),
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }
@ -264,7 +265,7 @@ export default {
) { ) {
return interaction.reply({ return interaction.reply({
content: loc.get(`c_${filename}3`), content: loc.get(`c_${filename}3`),
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }
@ -276,7 +277,7 @@ export default {
return deleteReminder(client, reminderInfo.creation_date, reminderInfo.user_id).then(() => return deleteReminder(client, reminderInfo.creation_date, reminderInfo.user_id).then(() =>
interaction.reply({ interaction.reply({
content: `Reminder **#${id}** supprimé !`, content: `Reminder **#${id}** supprimé !`,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}), }),
); );
} }

View file

@ -1,6 +1,12 @@
import { SlashCommandBuilder } from "@discordjs/builders"; import { SlashCommandBuilder } from "@discordjs/builders";
import { useMainPlayer, useQueue } from "discord-player"; import { useMainPlayer, useQueue } from "discord-player";
import { ChatInputCommandInteraction, Client, EmbedBuilder, Message } from "discord.js"; import {
ChatInputCommandInteraction,
Client,
EmbedBuilder,
Message,
MessageFlags,
} from "discord.js";
import { getLocale, getLocalizations } from "../../utils/locales"; import { getLocale, getLocalizations } from "../../utils/locales";
import { getFilename } from "../../utils/misc"; import { getFilename } from "../../utils/misc";
import { discord_limit_message } from "../../utils/constants"; import { discord_limit_message } from "../../utils/constants";
@ -90,7 +96,7 @@ export default {
await interaction.deferReply(); await interaction.deferReply();
const player = useMainPlayer(); const player = useMainPlayer();
const queue = useQueue(interaction.guildId!); const queue = useQueue();
if (request) { if (request) {
if ( if (
interaction.options.getSubcommand() === interaction.options.getSubcommand() ===
@ -110,7 +116,7 @@ export default {
if (track) { if (track) {
try { try {
data = await player.lyrics.search({ data = await player.lyrics.search({
q: track.cleanTitle + " " + queue.history.currentTrack?.author, q: track.author + " " + track.cleanTitle,
}); });
} catch { } catch {
return await interaction.followUp(`❌ | ${loc.get("c_lyrics2")} \`${track.title}\``); return await interaction.followUp(`❌ | ${loc.get("c_lyrics2")} \`${track.title}\``);
@ -169,7 +175,7 @@ export default {
return await interaction.followUp({ return await interaction.followUp({
content: `🎤 | ${loc.get("c_lyrics4")}`, content: `🎤 | ${loc.get("c_lyrics4")}`,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }

View file

@ -23,7 +23,7 @@ export default {
interaction: async (interaction: ChatInputCommandInteraction, client: Client) => { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = useQueue(interaction.guildId!); const queue = useQueue();
if (queue) { if (queue) {
const embed = new EmbedBuilder(); const embed = new EmbedBuilder();

View file

@ -5,6 +5,7 @@ import {
ChatInputCommandInteraction, ChatInputCommandInteraction,
Client, Client,
EmbedBuilder, EmbedBuilder,
MessageFlags,
} from "discord.js"; } from "discord.js";
import { getLocale, getLocalizations } from "../../utils/locales"; import { getLocale, getLocalizations } from "../../utils/locales";
import { Metadata } from "../../utils/metadata"; import { Metadata } from "../../utils/metadata";
@ -84,7 +85,7 @@ export default {
if (!member?.voice.channelId) { if (!member?.voice.channelId) {
return await interaction.reply({ return await interaction.reply({
content: `❌ | ${loc.get("c_play1")}`, content: `❌ | ${loc.get("c_play1")}`,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }
@ -94,7 +95,7 @@ export default {
) { ) {
return await interaction.reply({ return await interaction.reply({
content: `❌ | ${loc.get("c_play2")} ${interaction.guild.members.me.voice.channel}`, content: `❌ | ${loc.get("c_play2")} ${interaction.guild.members.me.voice.channel}`,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }
@ -104,7 +105,7 @@ export default {
if (!query) { if (!query) {
// Now playing // Now playing
const queue = useQueue(interaction.guildId!); const queue = useQueue();
if (queue) { if (queue) {
const track = queue.history.currentTrack; const track = queue.history.currentTrack;
@ -142,7 +143,7 @@ export default {
queue.delete(); queue.delete();
return await interaction.reply({ return await interaction.reply({
content: `❌ | ${loc.get("c_play3")}`, content: `❌ | ${loc.get("c_play3")}`,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }

View file

@ -94,7 +94,7 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = useQueue(interaction.guildId!); const queue = useQueue();
const embed = new EmbedBuilder(); const embed = new EmbedBuilder();
@ -127,15 +127,15 @@ export default {
), ),
); );
const message = await interaction.reply({ const callback = await interaction.reply({
embeds: [embed], embeds: [embed],
components: rows, components: rows,
fetchReply: true, withResponse: true,
}); });
// Buttons interactions // Buttons interactions
collect(client, interaction, idPrec, message); collect(client, interaction, idPrec, callback.resource!.message!);
collect(client, interaction, idNext, message); collect(client, interaction, idNext, callback.resource!.message!);
return; return;
} }

View file

@ -64,7 +64,7 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = useQueue(interaction.guildId!); const queue = useQueue();
if (queue) { if (queue) {
const subcommand = interaction.options.getSubcommand(); const subcommand = interaction.options.getSubcommand();

View file

@ -37,7 +37,7 @@ export default {
const filename = getFilename(__filename); const filename = getFilename(__filename);
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const queue = useQueue(interaction.guildId!); const queue = useQueue();
const id = interaction.options.getNumber(loc_default?.get(`c_${filename}_opt1_name`) as string); const id = interaction.options.getNumber(loc_default?.get(`c_${filename}_opt1_name`) as string);

View file

@ -1,5 +1,6 @@
import { Client, Interaction, InteractionType } from "discord.js"; import { Client, Interaction, InteractionType, MessageFlags } from "discord.js";
import { getLocale } from "../../utils/locales"; import { getLocale } from "../../utils/locales";
import { useMainPlayer } from "discord-player";
/** https://discord.js.org/#/docs/discord.js/main/class/Client?scrollTo=e-interactionCreate */ /** https://discord.js.org/#/docs/discord.js/main/class/Client?scrollTo=e-interactionCreate */
export default (interaction: Interaction, client: Client) => { export default (interaction: Interaction, client: Client) => {
@ -10,10 +11,19 @@ export default (interaction: Interaction, client: Client) => {
if (!command) { if (!command) {
return interaction.reply({ return interaction.reply({
content: loc.get("e_interacreate_no_command"), content: loc.get("e_interacreate_no_command"),
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }
if (interaction.guild) {
const player = useMainPlayer();
const data = {
guild: interaction.guild,
};
return player.context.provide(data, () => command.interaction(interaction, client));
}
return command.interaction(interaction, client); return command.interaction(interaction, client);
} }
@ -22,7 +32,7 @@ export default (interaction: Interaction, client: Client) => {
if (!modal) { if (!modal) {
return interaction.reply({ return interaction.reply({
content: loc.get("e_interacreate_no_modal"), content: loc.get("e_interacreate_no_modal"),
ephemeral: true, flags: [MessageFlags.Ephemeral],
}); });
} }

View file

@ -1,4 +1,4 @@
import { Client, ModalSubmitInteraction } from "discord.js"; import { Client, MessageFlags, ModalSubmitInteraction } from "discord.js";
import { getFilename } from "../../utils/misc"; import { getFilename } from "../../utils/misc";
import { newReminder } from "../../utils/commands/reminder"; import { newReminder } from "../../utils/commands/reminder";
@ -19,7 +19,7 @@ export default {
}).then((msg) => }).then((msg) =>
interaction.reply({ interaction.reply({
content: msg as string, content: msg as string,
ephemeral: true, flags: [MessageFlags.Ephemeral],
}), }),
); );
}, },

View file

@ -7,6 +7,7 @@ import { loadLocales } from "./locales";
import { YoutubeiExtractor } from "discord-player-youtubei"; import { YoutubeiExtractor } from "discord-player-youtubei";
import { readSQL } from "./db"; import { readSQL } from "./db";
import { isDev } from "./misc"; import { isDev } from "./misc";
import { DefaultExtractors } from "@discord-player/extractor";
/** Creation of the client and definition of its properties */ /** Creation of the client and definition of its properties */
export default async () => { export default async () => {
@ -46,14 +47,9 @@ export default async () => {
list: new Collection(), list: new Collection(),
}; };
const player = Player.singleton(client, { const player = new Player(client, { skipFFmpeg: true });
skipFFmpeg: true,
ytdlOptions: { await player.extractors.loadMulti(DefaultExtractors);
filter: "audioonly",
quality: "highestaudio",
},
});
await player.extractors.loadDefault((ext) => ext !== "YouTubeExtractor");
await player.extractors.register(YoutubeiExtractor, {}); await player.extractors.register(YoutubeiExtractor, {});
console.log("Translations progression :"); console.log("Translations progression :");