Will never use this, unfortunately, the mess with the docker image is too big for me atm
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 22s
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 22s
This commit is contained in:
parent
767612a000
commit
b35bcd0a39
2 changed files with 1 additions and 24 deletions
|
@ -5,7 +5,6 @@ import { Database } from "sqlite3";
|
||||||
import "../modules/client";
|
import "../modules/client";
|
||||||
import { loadLocales } from "./locales";
|
import { loadLocales } from "./locales";
|
||||||
import { YoutubeiExtractor } from "discord-player-youtubei";
|
import { YoutubeiExtractor } from "discord-player-youtubei";
|
||||||
import { YoutubeWebTokenRoutine } from "./music";
|
|
||||||
|
|
||||||
/** Creation of the client and definition of its properties */
|
/** Creation of the client and definition of its properties */
|
||||||
export default async (isDev: boolean) => {
|
export default async (isDev: boolean) => {
|
||||||
|
@ -45,9 +44,6 @@ export default async (isDev: boolean) => {
|
||||||
list: new Collection(),
|
list: new Collection(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Generate tokens
|
|
||||||
const tokens = await YoutubeWebTokenRoutine(true);
|
|
||||||
|
|
||||||
const player = Player.singleton(client, {
|
const player = Player.singleton(client, {
|
||||||
skipFFmpeg: true,
|
skipFFmpeg: true,
|
||||||
ytdlOptions: {
|
ytdlOptions: {
|
||||||
|
@ -56,12 +52,7 @@ export default async (isDev: boolean) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await player.extractors.loadDefault((ext) => ext !== "YouTubeExtractor");
|
await player.extractors.loadDefault((ext) => ext !== "YouTubeExtractor");
|
||||||
await player.extractors.register(YoutubeiExtractor, {
|
await player.extractors.register(YoutubeiExtractor, {});
|
||||||
streamOptions: {
|
|
||||||
useClient: "WEB",
|
|
||||||
},
|
|
||||||
trustedTokens: tokens,
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log("Translations progression :");
|
console.log("Translations progression :");
|
||||||
client.locales = await loadLocales(client.config.default_lang);
|
client.locales = await loadLocales(client.config.default_lang);
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { EmbedBuilder } from "@discordjs/builders";
|
||||||
import { GuildQueue, QueueRepeatMode } from "discord-player";
|
import { GuildQueue, QueueRepeatMode } from "discord-player";
|
||||||
import { Client } from "discord.js";
|
import { Client } from "discord.js";
|
||||||
import { getLocale } from "./locales";
|
import { getLocale } from "./locales";
|
||||||
import { generateTrustedToken, YoutubeiExtractor } from "discord-player-youtubei";
|
|
||||||
|
|
||||||
export const embedListQueue = (
|
export const embedListQueue = (
|
||||||
client: Client,
|
client: Client,
|
||||||
|
@ -58,16 +57,3 @@ const printRepeatMode = (mode: QueueRepeatMode, loc: Map<string, string>) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const YoutubeWebTokenRoutine = async (first: boolean) => {
|
|
||||||
// Repeat in one week : 7 * 24 * 60 * 60 * 1000
|
|
||||||
setTimeout(YoutubeWebTokenRoutine, 604800000, false);
|
|
||||||
|
|
||||||
const tokens = await generateTrustedToken();
|
|
||||||
if (first) {
|
|
||||||
return tokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
const instance = YoutubeiExtractor.getInstance();
|
|
||||||
instance?.setTrustedTokens(tokens);
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in a new issue