#Custom class-based client

1 messages · Page 1 of 1 (latest)

tender root
#

Let's continue here instead.

ivory flame
#
super({
  intents: [],
  partials: [],
  ...etc,
  ...options
})
fiery anchor
#

Good idea

#

so would I declare the intents and partials array themselves there then use this.intents and this.partials to fill them or?

flint nova
#

no

tender root
#
super({
    intents: [Intents.GUILD, ...],
    partials: ['MESSAGE', ...]
 })
flint nova
#

Don't use assignment to this

fiery anchor
#

ohhhh

#

I see

tender root
#

Take this as a base rule - DO NOT MODIFY LIBRARY PROPERTIES USING this

fiery anchor
#

okay

#

let me try this how you have it rq

flint nova
#

Where did you get the idea to assign them to this @fiery anchor

fiery anchor
#

my current knowledge of using class constructors and super calls

tender root
#

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

fiery anchor
#

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

tender root
#

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

fiery anchor
#

oh so I was trying to submit intents and partials after the bot was logged in essentially?

tender root
#

And you cannot change anything

fiery anchor
#

good to know,

fiery anchor
#

Got it

#

Glad I learned something out of this 😂

tender root
#

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

fiery anchor
tender root
#

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 ^

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;
tender root
fiery anchor
#

ah lemme try it

tender root
#

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

fiery anchor
#

nope it doesn't work

tender root
#

Okie