coding-buddies-discord / cb-bots

4 stars 3 forks source link

Earn/append caller to report #58

Closed waream2 closed 1 year ago

waream2 commented 1 year ago

I got a bit carried away this this PR but does two things:

waream2 commented 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.

cubiquitous commented 1 year ago

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

cubiquitous commented 1 year ago

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.

image

cubiquitous commented 1 year ago

try to reproduce the error multiple times and couldn't, therefore I think that is safe to merge