Hambergo / 9kmmrbot

MIT License
104 stars 29 forks source link

Rewrite Moderation.js #33

Closed tverghis closed 3 years ago

tverghis commented 5 years ago

Phew, this is a big file. In its current state, it's really just a massive if-else block with little organization. There are places where similar logic/functionality is repeated.

My goals for this rewrite are:

  1. Maintain all existing functionality; changes should be largely transparent to users.
  2. Re-organize code into smaller individual functions for each command. The file should be easier to read and navigate. It should be easy and obvious for future contributions to add commands and leverage shared functionality.
  3. Splitting up the code also opens up opportunities to introduce tests for individual commands. Try to do so where it makes sense, but it's not going to be a major focus of this PR. I'm planning on introducing Jest as a dev-dependency for this purpose.

Progress:

I'm keeping the commits separate for now, but I'll squash them in the end.

Bonus

Closes #14

Known issues (FIXME)

tverghis commented 5 years ago

(History looks a bit wonky because I rebased the dev branch changes into this branch, so I could catch merge conflicts early in case there were any)