Giter VIP home page Giter VIP logo

Comments (12)

anishshobithps avatar anishshobithps commented on August 20, 2024 1

@Androz2091 just found that, erela.js already manages sending packets to the discord API. what if you call sendWS function and manage it yourself ? The work around i have found was just making a new branch and support for discord.js v12. or this one above .
I have not tested it. I am kinda busy with exams and stuff and can't be more on computer for time being, plus I don't use erela.js. I use lavalink. Let me know if this works out , if it doesn't then I will ask war aka Solaris (now) to make a new branch for the support of discord.js-v12.

import { ErelaClient, IPacket } from '../src/index';
import { Client } from 'discord.js';
const client = new Client();
class lavalinkClient extends ErelaClient {
    sendWS(data: IPacket) {
        const guild = client.guilds.cache.get(data.d.guild_id);
        if (guild) { 
           const { shard } = client.guilds.cache.get(guild.id);
            shard.send(data);
        }
    }
}
const lavalink = new lavalinkClient(client, []);

I have not tested this. Let me know if this work around helps out , and more thing i forgot to mention was , Ipacket interface is not exported. I was editing the code so i exported in my case, in you case just make a interface

export interface IPacket {
    op: number;
    d: any;
    s?: number;
    t?: string;
}

from erela.js.

Androz2091 avatar Androz2091 commented on August 20, 2024 1

I tested this branch:
https://github.com/Anish-Shobith/erela.js/tree/v12-fix-build
And it didn't work, I need to edit this line to make it work.

if (typeof this.client.guilds.get(data.d.guild_id) !== "function") {

⬇️

if (typeof this.client.guilds.get !== "function") {

I also tested the code you sent above (to create a class that extends the ErelaClient one) and I had to use this.client.guilds instead of client.guilds. And it works!

from erela.js.

Solaris9 avatar Solaris9 commented on August 20, 2024 1

This is fixed and more in the development branch. I'll push to NPM soon.

from erela.js.

Strandxo avatar Strandxo commented on August 20, 2024

Discord.js doesn't "now" use anything. The master branch is a development branch that you use at your own risk. The stable branch however is still supported with the package. We are attempting to find a convenient way to allow the use of master with the package. Until then you can fork and alter the code yourself :)

from erela.js.

anishshobithps avatar anishshobithps commented on August 20, 2024

I will make a pr for it, after school ✌️

from erela.js.

Androz2091 avatar Androz2091 commented on August 20, 2024

It's what I did @Strandxo.

And what I wanted to say is "The master branch of Discord.js, which is a development branch, and which is supposed to be supported by the package now uses managers, whose aren't supported by this package.".
I'm sorry if I misspoke.

Nice @Anish-Shobith, thank youπŸ‘

from erela.js.

anishshobithps avatar anishshobithps commented on August 20, 2024

Thank you for testing it out. I will make a fix for it and ask war to make a public release for supporting v12 , if you check the development version , i guess he has used a better way to check v12 and v11 and i guess that should work a bit better than what i gave because its a bit lengthy.

const guild = (this.client.guilds.get ? this.client.guilds : this.client.guilds.cache).get(data.d.guild_id);

from erela.js.

Solaris9 avatar Solaris9 commented on August 20, 2024

Unfortunately I don't have the source code for the NPM release and the master branch hasn't been updated with the latest code, you'll probably encounter more bugs with the master branch than the release on NPM. The development branch should be good to use if you build it yourself using the TypeScript compiler.

from erela.js.

Strandxo avatar Strandxo commented on August 20, 2024

Just download the package from npm then you goose πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

from erela.js.

Solaris9 avatar Solaris9 commented on August 20, 2024

Just download the package from npm then you goose πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

no u, my mind is half gone from using gradle, but I can do that

from erela.js.

anishshobithps avatar anishshobithps commented on August 20, 2024

Lmfao

from erela.js.

Androz2091 avatar Androz2091 commented on August 20, 2024

Yes, that's kind of what I did 2 days ago on my fork πŸ˜„
Androz2091@2046635#diff-f568ea964ca83a683f3eca25fe73b67eR221

from erela.js.

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.