Code Monkey home page Code Monkey logo

Comments (11)

SushiBtw avatar SushiBtw commented on June 2, 2024 1

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.

from discord-music-player.

SushiBtw avatar SushiBtw commented on June 2, 2024 1

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.

from discord-music-player.

BrianWasTaken avatar BrianWasTaken commented on June 2, 2024

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!

from discord-music-player.

SushiBtw avatar SushiBtw commented on June 2, 2024

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

from discord-music-player.

BrianWasTaken avatar BrianWasTaken commented on June 2, 2024

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}`)
	}
	*/
})

from discord-music-player.

BrianWasTaken avatar BrianWasTaken commented on June 2, 2024

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

from discord-music-player.

BrianWasTaken avatar BrianWasTaken commented on June 2, 2024

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
}

from discord-music-player.

SushiBtw avatar SushiBtw commented on June 2, 2024

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.`);
}

from discord-music-player.

SushiBtw avatar SushiBtw commented on June 2, 2024

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

from discord-music-player.

SushiBtw avatar SushiBtw commented on June 2, 2024

We started working on it per #13.

from discord-music-player.

SushiBtw avatar SushiBtw commented on June 2, 2024

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

Thank you for reporting the issues and the suggestions!

from discord-music-player.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.