update dependencies and compatibility with dp7

This commit is contained in:
Mylloon 2025-01-02 22:29:54 +01:00
parent f851ac44f6
commit 9be710ef24
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
9 changed files with 1791 additions and 400 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

@ -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

@ -104,7 +104,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;

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();

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 } 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) => {
@ -14,6 +15,15 @@ export default (interaction: Interaction, client: Client) => {
}); });
} }
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);
} }

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 :");