Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion #3

Closed
BrianWasTaken opened this issue Nov 11, 2020 · 11 comments
Closed

Suggestion #3

BrianWasTaken opened this issue Nov 11, 2020 · 11 comments
Assignees
Labels
Feature Request New Feature Request.

Comments

@BrianWasTaken
Copy link

BrianWasTaken commented Nov 11, 2020

Hello, I wanna suggest or request some new features for this package. These features are broken on the original package (discord-player) so I wanna suggest it here.

  • filters - maybe good but, only some of the basic filters; e.g. bassboost, eight-D etc.
  • shuffle - allow to shuffle the queue? or is there a way to shuffle the queue? I don't know but, I might do it myself using JS
  • volume - a volume method so we could adjust the volume, idk but I cannot see it in the Docs.

Some issues:
The only issue I found is the client.player.nowPlaying(message.guild.id) method as it returns null or undefined.

Thanks!

@SushiBtw SushiBtw self-assigned this Nov 11, 2020
@SushiBtw SushiBtw added the Feature Request New Feature Request. label Nov 11, 2020
@SushiBtw
Copy link
Owner

Hello @BrianWasTkn!
Thank you for your suggestions/issue, let me tell you more about it!

Suggestions

Filters

Do you mean YouTube filters? Please let me know, I am already working on it.

Shuffle

There is a way by using JS to shuffle the queue, but I can make it easier - I am going to work on it.

Volume

Do you mean Volume? It's already a function in the module.

Issues

Now Playing Issue

Can you provide more information about it? Is that happening when the music is not playing?
Also, can you check this issue?

Let me know about it.

@BrianWasTaken
Copy link
Author

BrianWasTaken commented Nov 12, 2020

Hey! I wanna thank you for viewing my issue :)

Yes, Some filters and enhancements like bassboost, 8d and etc...

And about the nowplaying issue, i tried and debugged what the .nowPlaying method returns and it was empty or null. Liie, it doesn't return the current song playing in the queue.

Ty!

@SushiBtw
Copy link
Owner

Hey! Can I see your index, play and message code? That would help me with resolving the issue.

@BrianWasTaken
Copy link
Author

Um, My main index file is in a class to load other stuff but, I can show you the part where I initialized it.

index

import { Player } from 'discord-music-player'
import { Client } from 'discord.js'
// ...
class extends Client {
  constructor(clientOptions, playerOptions) {
    this.player = new Player(this, playerOptions)
  }
}

play

import Command from '../modules/command.js';

export default new Command({
	name: 'play',
	description: 'Play a song through searching, or even YouTube and Soundcloud',
	aliases: ['p'],
	permissions: ['SEND_MESSAGES'],
	usage: '<query>',
	cooldown: 3e3
}, async (bot, message, args) => {
	// State of the current member in/out of a VC
	const voiceChannel = message.member.voice.channel;
	// Member is not in a voice channel
	if (!voiceChannel) return 'You\'re not in a voice channel, pleace join in one.'
	// Args is empty so no song to play
	if (!args) return 'You need something to play'

	// Check if a track is currently playing
	const onQueue = bot.player.isPlaying(message.guild.id);
	if (onQueue) {
		try {
			const track = await bot.player.addToQueue(message.guild.id, args.join(' '), message.author.tag);
			const thumbRegex = /^(https\:\/\/i\.ytimg\.com\/vi.*\/.*\.(jpg|png|gif|webp))/gi;
			track.song.thumbnail = thumbRegex.exec(track.song.thumbnail)[1];
			// Return a message
			await message.channel.send({
				embed: {
					title: 'Added to Queue',
					color: 'BLUE',
					thumbnail: track.song.thumbnail,
					fields: [
						{
							name: `**__Requested by ${track.song.requestedBy}__**`, 
							value: `**Song:** [${track.song.name}](${track.song.url})\n**Duration:** ${track.song.duration}\n**Author:** ${track.song.author.name}`
						}
					]
				}
			});
		} catch(error) {
			bot.logger.command(`I cannot play the track: ${error.message}`)
		}
	} else {
		try {
			const track = await bot.player.play(voiceChannel, args.join(' '), message.author.tag);
			const thumbRegex = /^(https\:\/\/i\.ytimg\.com\/vi.*\/.*\.(jpg|png|gif|webp))/gi;
			track.song.thumbnail = thumbRegex.exec(track.song.thumbnail)[1];
			// Return a message
			await message.channel.send({
				embed: {
					title: 'Now Playing',
					color: 'BLUE',
					thumbnail: track.song.thumbnail,
					fields: [
						{
							name: `**__Requested by ${track.song.requestedBy}__**`, 
							value: `**Song:** [${track.song.name}](${track.song.url})\n**Duration:** ${track.song.duration}\n**Author:** ${track.song.author.name}`
						}
					]
				}
			});

			// Player events (temporary)
			const queue = bot.player.getQueue(message.guild.id);

			// song X is finished
			queue.on('songChanged', async (oldTrack, newTrack) => {
				await message.channel.send(`Now playing **${newTrack.name}** on the queue...`);
			});
			// queue ended
			queue.on('end', async() => {
				await message.channel.send('No song left to play, leaving channel...')
				await voiceChannel.leave()
			});

		} catch(error) {
			bot.logger.command(`I cannot play the track: ${error.message}`)
		}
	}

	/**
	// try and play it
	try {
		// play the song
		await bot.player.play(message, args.join(' '));
	} catch(error) {
		bot.logger.command(`I cannot play the track: ${error.message}`)
	}
	*/
})

@SushiBtw
Copy link
Owner

SushiBtw commented Nov 13, 2020

Hey, thank you for the code.
I did not found any code issues, could you please tell me what is [code] returning?

client.player.nowPlaying(guildID);

That would help me with resolving the issue.

Thanks.

@BrianWasTaken
Copy link
Author

Hey! I'm sorry for the delay, the project has errors due to something but in about one hour I'll try and debug it :D

@BrianWasTaken
Copy link
Author

Alright, here's the output now:

Song {
  name: 'Luis Fonsi - Despacito ft. Daddy Yankee',
  duration: '4:42',
  author: [Object],
  url: 'https://www.youtube.com/watch?v=kJQP7kiw5Fk',
  thumbnail: 'https://i.ytimg.com/vi/kJQP7kiw5Fk/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBH3EhyCr_aZDODXzXVDL-taforQw',
  queue: [Queue],
  requestedBy: undefined
}

@SushiBtw
Copy link
Owner

Can you try checking if the queue is not null (the song is not null) and we are going to investigate this issue?

Just try checking a Song via

client.player.nowPlaying(guildID)
.catch(err) {
   // Message is not playing.
   return message.reply(`No song set.`);
}

@SushiBtw SushiBtw removed the Bug label Nov 25, 2020
@SushiBtw
Copy link
Owner

Hey, the shuffle feature is under development and would be there in few days (with v6.0.0 update)!

@SushiBtw
Copy link
Owner

We started working on it per #13.

@SushiBtw SushiBtw mentioned this issue Nov 28, 2020
8 tasks
@SushiBtw
Copy link
Owner

This issue (and suggestions) are resolved (implemented) in v6.0.0 Update.

Thank you for reporting the issues and the suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New Feature Request.
Projects
None yet
Development

No branches or pull requests

2 participants