Coder Social home page Coder Social logo

kagchi / lavalink-repl Goto Github PK

View Code? Open in Web Editor NEW
52.0 1.0 125.0 47 KB

Lavalink on replit

License: MIT License

Shell 100.00%
replit lavalink lavalink-repl lavalink-musicbot lavalink-server lavalink-hosting lavalink-on-repl lavalink-on-replit

lavalink-repl's Introduction

lavalink-repl

Lavalink on replit

Connecting

  • Lavalink's port will always 443
  • Default password youshallnotpass
  • using custom lavalink client if your client doesnt support secure options

Important notes:

  • Do not change port in application.yml
  • To keep this 24/7 you need to make an account on UptimeRobot service, and make HTTP request to your app every 5 minutes. For example, if your app is named lavalink-repl and your repl username is ahmasa then make HTTP request to https://lavalink-repl.ahmasa.repl.co
  • Do not forget to set your password (in application.yml file)
  • Connection to node must be secured E.g https/wss\
  • Does not automatically update, you must specify AUTO_UPDATE true in environtment variables

Advantages:

  • Use java 13 :3
  • Easy setup
  • Using Dev build

Glitch

  • for glitch user here Repo

Example

  • Latest Shoukaku (v1.6.x)
const { Client } = require('discord.js');
const { Shoukaku, Libraries } = require('shoukaku');

const LavalinkServer = [{ name: 'my-lavalink-server', url: 'lavalink-repl.ahmasa.repl.co:443', auth: 'youshallnotpass', secure: true }];
const ShoukakuOptions = { moveOnDisconnect: false, resumable: false, resumableTimeout: 30, reconnectTries: 2, restTimeout: 10000 };

class ExampleBot extends Client {
    constructor(opts) {
        super(opts);
        this.shoukaku = new Shoukaku(new Libraries.DiscordJS(this), LavalinkServer, ShoukakuOptions);
    }

    login(token) {
        this._setupShoukakuEvents();
        this._setupClientEvents();
        return super.login(token);
    }

    _setupShoukakuEvents() {
        this.shoukaku.on('ready', (name) => console.log(`Lavalink ${name}: Ready!`));
        this.shoukaku.on('error', (name, error) => console.error(`Lavalink ${name}: Error Caught,`, error));
        this.shoukaku.on('close', (name, code, reason) => console.warn(`Lavalink ${name}: Closed, Code ${code}, Reason ${reason || 'No reason'}`));
        this.shoukaku.on('disconnected', (name, reason) => console.warn(`Lavalink ${name}: Disconnected, Reason ${reason || 'No reason'}`));
        this.shoukaku.on("debug", (name, reason) => console.debug(`Lavalink node ${name}`, reason || "No reason"));
    }

    _setupClientEvents() {
        this.on('messageCreate', async (msg) => {
            if (msg.author.bot || !msg.guild) return;
            if (!msg.content.startsWith('$play')) return;
            if (this.shoukaku.players.get(msg.guild.id)) return;
            const args = msg.content.split(' ');
            if (!args[0]) return;
            const node = this.shoukaku.getNode();
            let query = args.join(' ');
            let data = await node.rest.resolve(query);
            if (!data) return;
            const player = await node.joinChannel({
                guildId: msg.guild.id,
                shardId: msg.guild.shardId || 0,
                channelId: msg.member.voice.channelId,
                deaf: true
            });
            const events = ['end', 'error', 'closed', 'disconnect', 'nodeDisconnect'];
            for (const event of events) {
                player.on(event, info => {
                    console.log(info);
                    player.disconnect();
                });
            }
            data = data.tracks.shift();
            player.playTrack(data); 
            await msg.channel.send({ content: `Now Playing ${data.info.title}`});
        });
        this.on('ready', () => console.log('Bot is now ready'));
    }
}

new ExampleBot()
    .login('token')
    .catch(console.error);

Example bot here

lavalink-repl's People

Contributors

kagchi avatar rajamoulimallareddy avatar tysonop 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

Watchers

 avatar

lavalink-repl's Issues

ERROR 2885 Auth error

2021-10-11 17:19:41.500 ERROR 2885 --- [ XNIO-1 task-3] l.server.io.HandshakeInterceptorImpl : Authentication failed from /172.18.0.1:40680
2021-10-11 17:20:01.601 ERROR 2885 --- [ XNIO-1 task-4] l.server.io.HandshakeInterceptorImpl : Authentication failed from /172.18.0.1:53200
i tried
metrics:
prometheus:
enabled: true
endpoint: /version

and uptimerobot said the server is down 401

What is the id and host for the lavalink.

I am really sorry. I am dumb. I am a very casual coder and I am new to this.

  Lavalink: {
    id: "",
    host: "",
    port: ,
    pass: "",
  },

I understand that the pass will be the pass that i set up in application.yml. and port id 2333
What should be the host and id? like where can i find it in the code or on the console.

Cannot connect error 176.

What client do you use?
Glitch,
Are you sure using secure options?
Yes
Are you sure using port 443 when connecting?
Yes

The bot has worked like normal for months. But today it stopped working with error 176

image

Unexpected server response: 400

What client do you use?
Using erela.js
Are you sure using secure options?
N/A
Are you sure using port 443 when connecting?
Yes

receiving Unexpected server response: 400

Port:443

Host/Id: lavalink-repl.username.repl.co

Pass: from application.yml file

identifier

how to know / get own "identifier" in replt

Uptimebot

can you make it so we can actually record its uptime with uptimebot. like maybe add a webpage with express to avoid error code 401 and so that it gets marked as online in uptimebot.

Help

i followed your correctly and i connected the pass,port and link too but when i play some music ,it won't working .. no nodes are available

cannot connecting nodes

pls tell me how to find client

and i am using port 443

secure: 'true'

i am new to lavalink

[CANNOT CONNECT]

What client do you use?
Erelajs
Are you sure using secure options?
Yes
Are you sure using port 443 when connecting?
Yes
This is the error

getaddrinfo EAI_AGAIN lavalink-repl.username.repl.co

Unexpected server response: 307

Im getting that error after i use lavalink from repl.it once and then if i restart the bot it cant connect to the lavalink with error Unexpected server response: 307 but there is no error from lavalink

[CANNOT CONNECT]

What client do you use?
wavelink.py
Are you sure using secure options?
Yes
Are you sure using port 443 when connecting?
Yes!!

Extracting /tmp/jabba-d-181007028 to /home/runner/.jabba/jdk/[email protected] 
[..................] | rollbackFailedOptional: verb npm-session 4ab7deae[..................] | rollbackFailedOptional: verb npm-session 4ab7deae[..................] | rollbackFailedOptional: verb npm-session 4ab7deae[ .................] | preinstall:lavalink-server: info lifecycle lavali[ .................] | preinstall:lavalink-server: info lifecycle lavali[ .................] / loadIdealTree:loadAllDepsIntoIdealTree: sill inst[  ................] \ loadDep:got: sill install loadAllDepsIntoIdealTre[   ...............] \ loadDep:responselike: sill install loadAllDepsInt[   ...............] \ loadDep:json-buffer: sill install loadAllDepsInto[         .........] | prepare:lavalink-repl: info lifecycle lavalink-se
npm WARN [email protected] No repository field.

[         .........] | prepare:lavalink-repl: WARN [email protected][         .........] - prepare:lavalink-repl: WARN [email protected]
audited 33 packages in 1.365s

7 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

[         .........] \ prepare:lavalink-repl: timing audit body Complete

It is stuck here when trying to start

Error

How can i fix this error??
Firefox_Screenshot_2022-02-20T11-39-04 385Z

[CANNOT CONNECT in Lavalink]

What client do you use?
Lavalink
Are you sure using secure options?
Nope
Are you sure using port 443 when connecting?
Yes
Hello im trying to connect the lavalink into my bot but seems it says that the remote sever return 400
[NODE-eu-lavalink-repl.vnns.repl.co:443] The remote server returned code 400, the expected code was 101. This usually indicates that the remote server is a webserver and not Lavalink. Check your ports, and try again.

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.