#Using OOP in bot development
1 messages · Page 1 of 1 (latest)
I thought maybe
I thought maybe I should using something like array of commands (array of classes)
for commands, yea, for events not really, as you're only gonna use them once in your index
Also, is your bot open-source? I'd like to make a look. It's pretty hard to find sources on typescript with classes.
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
sadly not
But how are you providing access to DB without injecting client object in every callback?
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
offf
indeed
I'd so happy if someone would show me, how it should be xD
I even have thought about nestjs bridge xd
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
Sure, but it's interesting to see many ways of doing 1 thing
Also i have no much experience of making bots
So it can be helpful to see, how experienced devs do it
in that case, you can keep searching and asking people, browse github repos too, I took lots of inspiration from there
Is this "boilerplate" same for you?)
looks fine I guess
Want to separate my bot with modules. 1 independent system - 1 module.