wtfnotavailable / Discord-MusicBot

Discord Music Bot Source Tree / Mirror
https://git.dpaste.org/dmb/Discord-MusicBot
Other
145 stars 68 forks source link

/search shows wrong song data in "added to queue" message #232

Open PandaDriver156 opened 3 weeks ago

PandaDriver156 commented 3 weeks ago

Please describe the problem you are having in as much detail as possible:

Selecting a song from search results will add the correct song to queue, but displays data of the 1st song in search result in the "added to queue" embed message. image

Looking at the code, it's probably because in search.js in the embed res.tracks[0] is used instead of trackForPlay.tracks[0].

At this point I could have made a PR, let me know if i should do that.

Include a reproducible code sample here, if possible, the snippet of code which is throwing the error or which you presume is giving issues:

in search.js:

i.editReply({
            content: null,
            embeds: [
              new EmbedBuilder()
                .setAuthor({
                  name: "Added to queue",
                  iconURL: client.config.iconURL,
                })
                .setURL(res.tracks[0].uri)
                .setThumbnail(res.tracks[0].displayThumbnail("maxresdefault"))
                .setDescription(
                  `[${trackForPlay?.tracks[0]?.title}](${trackForPlay?.tracks[0].uri})` ||
                    "No Title"
                )
                .addFields(
                  {
                    name: "Added by",
                    value: `<@${interaction.user.id}>`,
                    inline: true,
                  },
                  {
                    name: "Duration",
                    value: res.tracks[0].isStream
                      ? `\`LIVE :red_circle:\``
                      : `\`${client.ms(res.tracks[0].duration, {
                          colonNotation: true,
                        })}\``,
                    inline: true,
                  }
                )
                .setColor(client.config.embedColor),
            ],
            components: [],
          });

If you have your own setup, without the original docker configuration, please provide:

Unrelated

Further details:

Relevant client options:

Neko-Life commented 3 weeks ago

PRs r welcome