update to discord-player-v6 #76

Merged
Anri merged 30 commits from feat/music-v6 into main 2023-03-11 20:36:25 +01:00
4 changed files with 8 additions and 8 deletions
Showing only changes of commit cb5adf3679 - Show all commits

View file

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

View file

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

View file

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

View file

@ -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[]) => {