#Custom class-based client
1 messages · Page 1 of 1 (latest)
super({
intents: [],
partials: [],
...etc,
...options
})
Good idea
so would I declare the intents and partials array themselves there then use this.intents and this.partials to fill them or?
no
super({
intents: [Intents.GUILD, ...],
partials: ['MESSAGE', ...]
})
Don't use assignment to this
Take this as a base rule - DO NOT MODIFY LIBRARY PROPERTIES USING this
Where did you get the idea to assign them to this @fiery anchor
my current knowledge of using class constructors and super calls
Basically, as you gain more knowledge, you will learn what you can do and what you cannot do. Then, you can slowly start studying the library code first and then modifying it
yeah
and it is working now there we go
with what I had before it wasn't listening for anything but now it is so that is good
This is what was happening:
When you create an object using new CustomClient(), the library attempts to connect to the discord api at the point of code when you do the super(options) call
Once the connection is established, the flow moves on to this.intents = [...] and so on.
But, your client has already connected to the discord api with empty intents
oh so I was trying to submit intents and partials after the bot was logged in essentially?
And you cannot change anything
good to know,
Yes, something like that
Actually, on closely inspecting the code, it seems that the intents are never stored as properties of class directly
So, this.intents would never work
Yep, Intents are completely separate from the Client class (I think that's what you were referring to?)
I'm probably gonna give you some bad advice, but try changing your original code to ```js
super(options);
this.options.intents = [...];
this.options.partials = [...];
``` Where ... would be the appropriate code in that part
And see if that works
@fiery anchor ^
@tender root wouldn't that just be a more complicated way of doing this since it'd be the same ultimately?
super({ inteents: [...], partials: [...], ...options })
this.intents = intents;
this.partials = partials;
I'm saying to use this.options.intents instead of this.intents
ah lemme try it
And remove the ones from super... Changing it back to just super(options)
This is only for learning... Don't do this unless you know what you're doing
nope it doesn't work
Okie