Giter VIP home page Giter VIP logo

erela.js's People

Contributors

3eif avatar acollierr17 avatar aeongdesu avatar anishshobithps avatar anonymous4078 avatar delxhq avatar doente avatar itsauric avatar jonasschiott avatar kingjesus0 avatar melodicalbuild avatar serenmodz21 avatar solaris9 avatar strandxo avatar viztea avatar zeroonedeveloper avatar zyphensvc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

erela.js's Issues

Bug with loop and pause method

This bug is linked to issue #27 . If you add a song to the queue, then loop the queue, then pause the queue, then add another song to the queue, erela.js will skip through everything in the queue. And since the song is looped, it will try to skip the same song over and over again, resulting in the trackStart event being emitted numerous times in the span of a couple of seconds.

image

Quick Question

When i just get my bot to the play the first time, how can i make it so both the enqueuing message and the now playing doesn't show. So like i can have it so just the now playing message shows and then the enqueuing message shows when you add another song to the queue.

Hopefully this makes sense

Error with player.clearEQ()

When I updated the library to the latest version (v2.3.0), it started giving the following error in player.clearEQ();

Bands must be a non-empty object array containing 'band' and 'gain' properties.

queueRepeat doesn't work (rewrite)

I'm doing setQueueRepeat(true) but it doesn't loop the queue at all.

Here I play two songs, loop the queue, check if the queue is looped, then I skip both songs and the queue ends...

image
image

Search method sometimes will not return any results

Every now and again when using the search method it will return "No tracks were found." Yet if I search the same thing another 1 - 3 times it will give me results. It seems to be very random as when I try to recreate the issue I get varied results.

Remove Stores

The idea of stores is to enable the organization and management of players and nodes; however, stores are bloat to the library.

Audio not playing in voice channel.

Hi guys!

I've been really excited to use this library.

Today I decided to code a music category for my bot.
But unfortunately, When ever I tell a player to play the current queue.. It doesn't play the audio in the voice channel.

Here is my code:

const { voice } = message.member;
    if(voice.channel){
        var player = this.client.music.players.spawn({
                textChannel: message.channel,
                guild: message.guild,
                voiceChannel: voice.channel
        });
        var searchResults = await this.client.music.search(args.query, message.author);
        //console.log(searchResults);
        player.queue.add(searchResults.tracks[0]);
        console.log(player.queue);
        player.play()

The track is added to the queue, everything works fine for now.. Till player.play() is executed! It actually emit the event trackStart but it doesn't play audio in the voice channel.
I've tried discord.js music code from the guides, It worked.

Note: I'm using discord-akairo framework for my bot.

Thanks in advance. ;)

formatTime parsing incorrectly?

When the milliseconds parameter is less than 60 seconds, it returns ss, when it should return 00:ss because when the milliseconds parameter is 60 seconds or more, it returns mm:ss.

Can't play another track after it ended playing one.

So it spawns the bot and joins the voice channel without a problem and playing the song works too. But if you add a new song after the currently playing one has ended and the queue is empty it wont play anything. But if you add a new song while the one u added before was still playing it would just work fine, only way to make it work again is to destroy the player and add the song to the queue again. I used the example code from the readme file.

Everytime this happen

Node "default" encountered an error: connect ECONNREFUSED My ip can't send here:2333.

Transition Things - (NPM)

A reminder/note for the transfer over the coming days.
Update both homepage and repository links on the npm page so they resolve to this repo

Music not playing

I tried to play music but it's just not playing I console logged around the bot joins channel sends queue message adds the song to playlist it just is not playing anything

Cannot search tracks via link

The error returned in d.js is 400 (Bad request).
Lavalink returned the error where the identifier cannot be found.

Song duration

Hi, why is song's duration undefined each time the player repeat that song even though my progress bar is still working?

Please add

Add a pagination embed for the example queue command
Because i tried so hard to make one and failed horribly so if someone could make or help me make one i will be appreciated
Thank you for reading this.

issue with pausing the player

An empty player with no playing audio can be unpaused and will play nothing and player.playing will be true
This happens when a track is added to the queue while the player is not playing. When you resume the player gets stuck at that position since there is no way to find out from the player if it is playing audio or not... Player.playing returns true and player.queue.current returns the track that was added while the player was not playing.

bot creating nodes untill it fails

I started erela client in on ready event of Discord bot
here is what it looks like

client.music = new ErelaClient(client, nodes)
        .on("nodeError", console.log)
        .on("nodeConnect", () => console.log("Successfully created a new Node."))
        .on("queueEnd", player => {
            player.textChannel.send("Queue has ended.")
            return client.music.players.destroy(player.guild.id)
        })
        .on("trackStart", ({textChannel}, {title, duration}) => textChannel.send(`Now playing: **${title}** \`${Utils.formatTime(duration, true)}\``).then(m => m.delete(15000)));

but in my console log it looks like this

Hi, Azooid is now online and ready to server in 5 servers and serving 608 users!.
done saving serversettings.json  // my other stuff
complete                                     // my other stuff
Successfully created a new Node.  // from here the erela client starts connecting node
Successfully created a new Node.
Successfully created a new Node.
Successfully created a new Node.
Successfully created a new Node.
Successfully created a new Node.  // untill 5-7 min i can play music in bot but when it stops it wont play again
Node {
  reconnectAttempts: 5,
  calls: 1,
  erela:
 ........... for full log i pasted it to paste bin 

https://pastebin.com/vpbkQmCi - console log from node

client.guilds.get is not a function - Discord.js cache not supported

It throws the following error:

(node:34738) UnhandledPromiseRejectionWarning: TypeError: this.client.guilds.get is not a function
    at ErelaClient.sendWS (/Users/simon/Documents/GitHub/AtlantaBotv5/node_modules/erela.js/dist/lib/ErelaClient.js:218:42)
    at Map.spawn (/Users/simon/Documents/GitHub/AtlantaBotv5/node_modules/erela.js/dist/lib/stores/PlayerStore.js:34:20)
    at module.exports.execute (/Users/simon/Documents/GitHub/AtlantaBotv5/src/commands/Music/play.js:18:50)
    at Message.execute (/Users/simon/Documents/GitHub/AtlantaBotv5/src/events/message.js:161:21)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:34738) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:34738) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

when I try to spawn a player using the master branch of Discord.js. Discord.js now uses Managers and removed Datastores so we need to use client.guilds.cache.get now. Please fix this ๐Ÿ™

Can't open documentation website

Hey, today I wanted to take a look into the documentation of erela.js but the domain to the website doesn't work anymore. Looking around I found that you are working on a new version of erela.js and that you have a new website. Could you by any chance reupload the old erela documentation?

Search Results

A playlist URL or a song URL triggers the SEARCH_RESULT when the player is playing.

The playlist tracks and the url track is loaded to the queue tho, but it also shows the playlist tracks as a search results and i can choose the result number. same as the single track url but the result is only one

Cannot connect to any nodes

When trying to connect to my node, I get this error:

Error: connect ECONNREFUSED 127.0.0.1:7000.

I "fixed" this error by making a server to run on https://localhost:7000.
Didn't actually fix it, I get this error now:

Error: Unexpected server response: 200.

my code seems fine, its just this:

this.music = new Manager({
    nodes,
    send: (id, payload) => {
        const guild = client.guilds.cache.get(id);
        if (guild) guild.shard.send(payload);
    }
})
.on("nodeConnect", node => {
    console.log(`Node "${node.options.identifier}" connected.`);
})
.on("nodeError", (node, error) => {
    console.log(`Node "${node.options.identifier}" encountered an error: ${error}.`);
});

this.once('ready', () => {
  console.log(`${this.user.tag} has logged in.`);

  const server = require('../../server/server');

  this.music.init(this.user.id);
});

'this' is a discord.js client.

(none of the tutorials I've watched have mentioned setting up a server with express, I just figured it might work)

I can't seem to figure out what's going on, lavalink.jar starts up fine, with a few warnings. It says this when it starts:

Started Launcher in 3.483 seconds (JVM running for 3.94)

but, it also says this:

Undertow started on port(s) 8080 (http) with context path ' '

My OS is Mac OS X.
if anyone can help I would appreciate it! Thanks!

Playlists broken in rewrite.

Playlists seem to be erroring in the rewrite. This error pops up when playing playlists on Youtube, Soundcloud and Bandcamp:

TypeError: Cannot read property 'info' of undefined
    at Manager.<anonymous> (/root/ear_tensifier/node_modules/@tetracyl/erela.js/dist/structures/Manager.js:108:49)
    at Generator.next (<anonymous>)
    at fulfilled (/root/ear_tensifier/node_modules/@tetracyl/erela.js/dist/structures/Manager.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

"Plugin at index [x] does not extend Plugin." when loading Spotify plugin

When loading the Spotify Erela addon (https://github.com/Solaris9/erela.js-spotify), erela.js crashes with the message in the title. After further code inspection, I found out the Spotify plugin constructor does in fact extend it (https://github.com/Solaris9/erela.js-spotify/blob/master/src/plugin.ts#L66) but it isn't correctly recognized as one by the plugin loader.

To counter this and try to find a solution, when commenting out this line: https://github.com/Solaris9/erela.js/blob/master/src/structures/Manager.ts#L259 it obviously does not throw an error - as expected - but the manager does not finish loading and the client.manager property isn't populated.

This error may not be exclusive to the Spotify addon, it could also be affecting any other plugin, but I didn't check it.

Edit: code if needed

client.manager = new Erela.Manager({
	nodes,
	plugins: [
		new Spotify({
			clientID: `something`
			clientSecret: `something`
		})
	],
	send(id, payload) {
		const guild = client.guilds.cache.get(id);
		if (guild) guild.shard.send(payload);
	},
})

Whenever I try to search for a song it gives me this error

This is my code

const search = await undefined.manager.search(`https://www.youtube.com/watch?v=${trackselected.id}`, msg.author);
return console.log(search);
//err
{
  loadType: 'LOAD_FAILED',
  exception: {
    severity: 'SUSPICIOUS',
    message: 'Received unexpected response from YouTube.'
  },
  tracks: []
}

EDIT: It was my lavalink.jar file (it was outdated) that was causing the issue

queue.remove() not working as intended?

Hi! I'm not sure If I'm reading it wrong or using it improperly, but I'm trying to let the users choose what track to remove from the queue and no matter what number the user replies with, it only removes the next track after the current one playing. It does not remove the specified track.

player.queue.remove(args[0])

is what I'm using, if you need more let me know!

Any ideas? (Using up to date version of erela.js)

you can't use 2 client.

I'm trying to use 2 clients at the same time but I don't know why when I create a player in the second client it creates in the first, any idea?

I used the example in the docs to make it easier for you to understand but I tweak it a bit to accept 2 clients or more:

const { Client } = require("discord.js");
const { Manager } = require("erela.js");
const { tokens } = require('./tokens');

(async () => {
  for (let token of tokens) {

    const client = new Client();

    await client.login(token);

    client.manager = new Manager({
      nodes: [
        {
          host: "localhost", 
          port: 41892, 
          password: "$2FOYMnktb4Zg0lF2kBuj%YgB@v!BS!CC9$NY!pOVNO95OELvG", 
          identifier: client.user.id // <-- I've tried to create an identifier to specify it when creating a player but I think the nodes are separated between the clients already
        },
      ],
      send(id, payload) {
        const guild = client.guilds.cache.get(id);
        if (guild) guild.shard.send(payload);
      },
    })
      .on("nodeConnect", node => console.log(`Node ${node.options.identifier} connected`))
      .on("nodeError", (node, error) => console.log(`Node ${node.options.identifier} had an error: ${error.message}`))
      .on("trackStart", (player, track) => {
        client.channels.cache
          .get(player.textChannel)
          .send(`Now playing: ${track.title}`);
      })
      .on("queueEnd", (player) => {
        client.channels.cache
          .get(player.textChannel)
          .send("Queue has ended.");

        player.destroy();
      });

    client.once("ready", () => {
      console.log("I am ready!");
      client.manager.init(client.user.id);
    });

    client.on("raw", (d) => client.manager.updateVoiceState(d));

    client.on("message", async (message) => {
      if (message.content.startsWith(client.user.id + "play")) {

        const res = await client.manager.search(
          message.content.slice(6),
          message.author
        );

        const player = client.manager.create({
          guild: message.guild.id,
          voiceChannel: message.member.voice.channel.id,
          textChannel: message.channel.id,
          node: client.user.id // <-- here i'm trying to use the node
        });

        player.connect();

        player.queue.add(res.tracks[0]);
        message.channel.send(`Enqueuing track ${res.tracks[0].title}.`);

        if (!player.playing && !player.paused && !player.queue.size)
          player.play();

        if (
          !player.playing &&
          !player.paused &&
          player.queue.totalSize === res.tracks.length
        )
          player.play();
      }
    });

  }
})();

however when i try to play something like 784823155860308038play happier using the second client it runs in the first one:

<ref *1> Manager {
  _events: [Object: null prototype] {   
    nodeConnect: [Function (anonymous)],
    nodeError: [Function (anonymous)],  
    trackStart: [Function (anonymous)], 
    queueEnd: [Function (anonymous)]    
  },
  _eventsCount: 4,
  _maxListeners: undefined,
  players: Collection(0) [Map] {},      
  nodes: Collection(1) [Map] {
    '784823155860308038' => Node { // <-- look here the id of the second client
      options: [Object],
      socket: [WebSocket],
      calls: 1,
      reconnectAttempts: 1,
      manager: [Circular *1],
      stats: [Object]
    }
  },
  initiated: true,
  options: {
    plugins: [],
    nodes: [ [Object] ],
    shards: 1,
    autoPlay: true,
    send: [Function: send],
    clientId: '784823155860308038' // <-- look here the id of the second client
  },
  [Symbol(kCapture)]: false
}

but the one who played music is the first one with id 730472633388236831

queue.remove(start,end) not working

Hi, I'm trying to use player.queue.remove(start, end).
Unfortunately, if I give the number 0 as the start, I get an error missing start parameter. If I enter the number 1 instead of start, I get an error start parameter cannot be bigger then 0.

I am doing something wrong?
Why can't I remove a range like this from start index 5 to end index 10, for example?

TrackStart emitted multiple times bug

bug

When i play something (lets consider there's only 1 song added) and then i skip or stop which (player.stop()) and then if i add another song the "trackStart" even is emitted twice. and also the queueRepeat which is supposed to loop the queue gets ignored when you "skip" a song even when loop is enabled using the player.setQueueRepeat() method. Im using erelajs 2.3.0..

Filter issues

It seems when ever i set filters it sounds like earrape

Bug with pause method

If you add a song to the queue, then pause the queue using the pause method, then add another song to the queue, erela.js will skip all songs in the queue and emit the trackStart event for each song in the queue. This might cause the bot to spam depending on how many songs are in the queue.

image

Music sometimes doesn't start playing

Me again.
If I call the play command, the music sometimes doesn't start playing. I have to call the command again and the music will start playing.
I enclose the Lavalink log screenshot.

image

how can i get live duration of song

Normally to get the duration of song is

const player = client.music.players.get(message.guild.id);
const { title, author, duration, thumbnail } = player.queue[0];

this line will simply give me total duration of current song but how can i get current duration of the song
example 1:12/4:24 here what i want to get is 1:12 which i will edit the last massage and edit the massage every 5 sec

Plugins Support

Users should be able to configure and add third-party plugins to maximize customization if they desire.

conts AwesomePlugin = require('./my_plugin');
const client = new ErelaClient({
	plugin: new AwesomePlugin()
});

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.