Comments (12)
@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.
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.
This is fixed and more in the development branch. I'll push to NPM soon.
from erela.js.
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.
I will make a pr for it, after school βοΈ
from erela.js.
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.
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.
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.
Just download the package from npm then you goose ππππ
from erela.js.
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.
Lmfao
from erela.js.
Yes, that's kind of what I did 2 days ago on my fork π
Androz2091@2046635#diff-f568ea964ca83a683f3eca25fe73b67eR221
from erela.js.
Related Issues (20)
- Feature Request: ytmsearch
- Weird Queue Problem HOT 4
- defaultSearchPlatform does not work HOT 3
- I donβt understand anything anymore
- Broken with nodejs 18.6 HOT 2
- updateVoiceState on the client issue HOT 2
- Error: Cannot read properties of undefined (reading 'track')
- Unexpected token in JSON at position 0 HOT 2
- Add queue/player events
- Cannot read properties of undefined (reading 'map') : Manager.js:155:36 HOT 1
- Update HOT 6
- Init bug HOT 8
- petitio causing a lot of errors HOT 25
- petitio: unexpected token in json HOT 4
- Plugin Issues HOT 1
- Unexpected token in JSON at position 0 HOT 3
- SyntaxError: Unexpected token in JSON at position 0 on Linux. HOT 1
- Some plugins does not work after latest update HOT 2
- Cannot read properties of undefined (reading 'map'): Manager.js:161:36
- TypeError: finalQuery.match is not a function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erela.js.