Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactorise entire codebase for modularity and cleanup #17

Merged
merged 65 commits into from
Mar 5, 2021

Conversation

yutotakano
Copy link
Collaborator

@yutotakano yutotakano commented Mar 3, 2021

Changed

  • Conceptually renamed "handlers" to "receivers"
  • Made each module export only a list of receivers (Intent system that @9nine9nine9 described) so it is easily extensible and future-proof
    • Adding a new command in an existing module only requires a change in that module
    • Creating new modules requires you to register the module in EventHandler and the cabal file as before
  • Abstracted away DiscordHandler (Either RestCallErrorCode Message) to a cleaner DiscordHandler () since the returned Message isn't used anyway
  • Gave all receivers a consistent type signature (Message -> DiscordHandler (), or ReactionInfo -> DiscordHandler ())
  • Use T.Text for all possible places apart from when interacting with functions that require String (e.g. disk IO), and Main
  • Added new Util methods to create commands: newCommand and newDevCommand. This abstracts away RegEx matching and subgroup capturing as well as dev checking
    • This also puts all the RegEx into the receiver module itself, so all RE files (apart from TemplateRE) has been removed
  • Formatted the entire codebase: aligned imports, comma-broken lists (diff becomes cleaner), and ~80 char wraps
    • Made code structure somewhat consistent throughout the codebase, so new additions can easily reference styles from wherever it wants
  • Renamed several functions to be more representative of what they're responsible
  • Removed any legacy unused code
  • Updated README with more information, added a Dockerfile (untested) for better deployment
  • Fixed several issues that were open
  • Created a Parsec parser for CSV files, and delegated all CSV work into there (includes unit tests)
    • IMPORTANT: Changed location of csv storage from src/config/~~.conf to .owen/~~.csv.
    • IMPORTANT: All .csv files now require a new line at the end
    • IMPORTANT: fame.csv and devs.csv are now ONE ITEM PER LINE, instead of a comma separated single line

Unchanged

  • Nothing...

Requesting some local testing or review before actually merging, because although I tested on my machine, most of the code is newly written and therefore prone to mistakes/errors. (...or we can just merge and test in production lmao)

@yutotakano yutotakano linked an issue Mar 4, 2021 that may be closed by this pull request
@yutotakano yutotakano added the enhancement New feature or request label Mar 4, 2021
@yutotakano yutotakano self-assigned this Mar 4, 2021
@yutotakano yutotakano merged commit 4b08aad into yellowtides:main Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistency with regex handling.
1 participant