Closed waream2 closed 1 year ago
I think that my main confusion is why to use a static class instead of instantiating with BuddiesModel.
We dont really need instance methods at this time. Because we don't really need any instantiations of the Model except for the main one that's written here.
Static methods just allow us to use the methods around the bot without having to create a new instance of the model with stateful data.
I think we should eventually refactor this to be a true CRUD db model, that we can extend to fit work against the different collections. e.g. we'd have BaseModel
that can simply READ, WRITE, UPDATE, DELETE, it's dumb and doesn't have collection info or anything.
We would then extend it out to the different collections Points
Bios
TheOneYouThoughtOfAndICantRemember
and those extensions would contain the methods we need against that collection and call super
against the basic CRUD methods from the Base.
This may or may not make sense, let me know if I can try and clarify more. It's an idea in my head that I think will prove to be nice for this project.
yeah, i guess it makes sense right now to have this way, but I can see that soon we'll have to instantiate and export the instance.
i'll just test it to be sure that all is working and if there's no problems i'll merge
there's 1 issue: even if the person who requested the !points has no points, it still shows up in the table as having 1 point.
try to reproduce the error multiple times and couldn't, therefore I think that is safe to merge
I got a bit carried away this this PR but does two things:
BuddiesModel.staticMethod()
. This change is just an attempt to clean up a little bit. I think also as the bot expands, it gives us a better foundation to have a model to work with, if we start needed more collections than just points. This will also make testing MUCH easier.