From bc86fb808239eee171c6a40c6d6ebea8c6448008 Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Sat, 7 Aug 2021 19:15:39 +0200 Subject: [PATCH 1/2] :bug: Fix example bot --- example/music-bot/index.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/example/music-bot/index.js b/example/music-bot/index.js index 21579bb..c6abed3 100644 --- a/example/music-bot/index.js +++ b/example/music-bot/index.js @@ -1,6 +1,6 @@ const { Client, GuildMember } = require("discord.js"); const config = require("./config"); -const { Player, QueryType, QueueRepeatMode } = require("discord-player"); +const { Player, QueryType, QueueRepeatMode } = require("../../"); const client = new Client({ intents: ["GUILD_VOICE_STATES", "GUILD_MESSAGES", "GUILDS"] @@ -164,7 +164,7 @@ client.on("interactionCreate", async (interaction) => { } if (interaction.commandName === "play" || interaction.commandName === "soundcloud") { - await interaction.defer(); + await interaction.deferReply(); const query = interaction.options.get("query").value; const searchResult = await player @@ -190,7 +190,7 @@ client.on("interactionCreate", async (interaction) => { searchResult.playlist ? queue.addTracks(searchResult.tracks) : queue.addTrack(searchResult.tracks[0]); if (!queue.playing) await queue.play(); } else if (interaction.commandName === "volume") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); const vol = interaction.options.get("amount"); @@ -201,7 +201,7 @@ client.on("interactionCreate", async (interaction) => { content: success ? `✅ | Volume set to **${vol.value}%**!` : "❌ | Something went wrong!" }); } else if (interaction.commandName === "skip") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); const currentTrack = queue.current; @@ -210,7 +210,7 @@ client.on("interactionCreate", async (interaction) => { content: success ? `✅ | Skipped **${currentTrack}**!` : "❌ | Something went wrong!" }); } else if (interaction.commandName === "queue") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); const currentTrack = queue.current; @@ -233,25 +233,25 @@ client.on("interactionCreate", async (interaction) => { ] }); } else if (interaction.commandName === "pause") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); const success = queue.setPaused(true); return void interaction.followUp({ content: success ? "⏸ | Paused!" : "❌ | Something went wrong!" }); } else if (interaction.commandName === "resume") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); const success = queue.setPaused(false); return void interaction.followUp({ content: success ? "▶ | Resumed!" : "❌ | Something went wrong!" }); } else if (interaction.commandName === "stop") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); queue.destroy(); return void interaction.followUp({ content: "🛑 | Stopped the player!" }); } else if (interaction.commandName === "np") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); const progress = queue.createProgressBar(); @@ -273,7 +273,7 @@ client.on("interactionCreate", async (interaction) => { ] }); } else if (interaction.commandName === "loop") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); const loopMode = interaction.options.get("mode").value; @@ -281,7 +281,7 @@ client.on("interactionCreate", async (interaction) => { const mode = loopMode === QueueRepeatMode.TRACK ? "🔂" : loopMode === QueueRepeatMode.QUEUE ? "🔁" : "▶"; return void interaction.followUp({ content: success ? `${mode} | Updated loop mode!` : "❌ | Could not update loop mode!" }); } else if (interaction.commandName === "bassboost") { - await interaction.defer(); + await interaction.deferReply(); const queue = player.getQueue(interaction.guildId); if (!queue || !queue.playing) return void interaction.followUp({ content: "❌ | No music is being played!" }); await queue.setFilters({ From d96a432f5d885318059b6eec251b15eb8a283b58 Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Sat, 7 Aug 2021 19:16:11 +0200 Subject: [PATCH 2/2] :bug: Fix discord-player import path for example bot --- example/music-bot/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/music-bot/index.js b/example/music-bot/index.js index c6abed3..dea4277 100644 --- a/example/music-bot/index.js +++ b/example/music-bot/index.js @@ -1,6 +1,6 @@ const { Client, GuildMember } = require("discord.js"); const config = require("./config"); -const { Player, QueryType, QueueRepeatMode } = require("../../"); +const { Player, QueryType, QueueRepeatMode } = require("discord-player"); const client = new Client({ intents: ["GUILD_VOICE_STATES", "GUILD_MESSAGES", "GUILDS"]