From cb5adf3679c22c871d3e24da1670b45f81bfc8cc Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 11 Mar 2023 07:52:54 +0100 Subject: [PATCH] use "useMasterPlayer" --- src/commands/music/lyrics.ts | 4 ++-- src/commands/music/play.ts | 4 ++-- src/commands/music/stop.ts | 4 ++-- src/events/loader.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/commands/music/lyrics.ts b/src/commands/music/lyrics.ts index b770fca..f0896cd 100644 --- a/src/commands/music/lyrics.ts +++ b/src/commands/music/lyrics.ts @@ -1,5 +1,5 @@ import { SlashCommandBuilder } from "@discordjs/builders"; -import { Player, useQueue } from "discord-player"; +import { Player, useMasterPlayer, useQueue } from "discord-player"; import { ChatInputCommandInteraction, Client, EmbedBuilder } from "discord.js"; import { getLocale, getLocalizations } from "../../utils/locales"; import { getFilename } from "../../utils/misc"; @@ -45,7 +45,7 @@ export default { let data = null; await interaction.deferReply(); - const player = Player.singleton(client); + const player = useMasterPlayer() as Player; if (request) { try { data = await player.lyrics.search(request); diff --git a/src/commands/music/play.ts b/src/commands/music/play.ts index 861d8c0..7821691 100644 --- a/src/commands/music/play.ts +++ b/src/commands/music/play.ts @@ -9,7 +9,7 @@ import { import { Metadata } from "../../utils/metadata"; import { getLocale, getLocalizations } from "../../utils/locales"; import { getFilename } from "../../utils/misc"; -import { Player, useQueue } from "discord-player"; +import { Player, useMasterPlayer, useQueue } from "discord-player"; export default { scope: () => [], @@ -69,7 +69,7 @@ export default { loc_default?.get(`c_${filename}_opt1_name`) as string ); - const player = Player.singleton(client); + const player = useMasterPlayer() as Player; if (!query) { // Now playing diff --git a/src/commands/music/stop.ts b/src/commands/music/stop.ts index 1dc6c95..3cbe9e6 100644 --- a/src/commands/music/stop.ts +++ b/src/commands/music/stop.ts @@ -3,7 +3,7 @@ import { ChatInputCommandInteraction, Client, GuildResolvable } from "discord.js import { Metadata } from "../../utils/metadata"; import { getLocale, getLocalizations } from "../../utils/locales"; import { getFilename } from "../../utils/misc"; -import { Player } from "discord-player"; +import { Player, useMasterPlayer } from "discord-player"; export default { scope: () => [], @@ -25,7 +25,7 @@ export default { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => { const loc = getLocale(client, interaction.locale); - const player = Player.singleton(client); + const player = useMasterPlayer() as Player; const queue = player.nodes.create(interaction.guild as GuildResolvable, { metadata: { channel: interaction.channel, diff --git a/src/events/loader.ts b/src/events/loader.ts index d0d60ab..b6e0155 100644 --- a/src/events/loader.ts +++ b/src/events/loader.ts @@ -1,4 +1,4 @@ -import { Player, PlayerEvents } from "discord-player"; +import { Player, PlayerEvents, useMasterPlayer } from "discord-player"; import { Client } from "discord.js"; import { readdir } from "fs/promises"; @@ -29,7 +29,7 @@ export default async (client: Client) => { const event_type = event_type_ext.join("."); if (event_category == "player") { - const player = Player.singleton(client); + const player = useMasterPlayer() as Player; if (once) { // eslint-disable-next-line return player.events.once(event_type as keyof PlayerEvents, (...args: any[]) => {