#Using OOP in bot development

1 messages · Page 1 of 1 (latest)

rancid solstice
#

I thought maybe

#

I thought maybe I should using something like array of commands (array of classes)

dreamy wraith
#

for commands, yea, for events not really, as you're only gonna use them once in your index

rancid solstice
dreamy wraith
#

For example, this is my custom client class, you can see in the addCommand method I just set a new key on the commands collection

rancid solstice
dreamy wraith
#

this is exactly why my code isn't open source: it's probably the wrong way of doing things

as you can see I declare db without assigning it any value in the constructor, that's taken care of outside the class like this

#

and from there, I only need to use the db inside of a few commands, so as I said, I have to cast the client param to CustomClient and then access the .db property inside that command

rancid solstice
#

offf

dreamy wraith
#

indeed

rancid solstice
#

I'd so happy if someone would show me, how it should be xD

#

I even have thought about nestjs bridge xd

dreamy wraith
#

I'm not nearly good enough as a dev, sorry :p
but I guess you can get an idea of how to write your own code from this, cuz there's no 1 size fits all, no right way of doing things, because everyone writes their code differently, you have to experiment to get it to however you want

rancid solstice
#

Also i have no much experience of making bots

#

So it can be helpful to see, how experienced devs do it

dreamy wraith
rancid solstice
dreamy wraith
#

looks fine I guess

rancid solstice