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

Refactor cogs to generalise config access #48

Closed
Laogeodritt opened this issue Mar 5, 2018 · 1 comment
Closed

Refactor cogs to generalise config access #48

Laogeodritt opened this issue Mar 5, 2018 · 1 comment

Comments

@Laogeodritt
Copy link
Collaborator

Laogeodritt commented Mar 5, 2018

Currently, most cogs manually call get_kaztron_config() and store a reference in an attribute, as well as similar calls for the state.json config and any cog-specific config files. For the latter two, many of them also tend to have

Can this be generalised to reduce repetition?

  • Base class that loads and provides the config object attribute, as well as direct accessors of some sort for the cog-specific and general (core/discord) sections of the config files?
  • on_ready status/precondition on all commands? (pre-command hook - can it cancel command?)
  • Abstract base class with deserialise/serialise hooks to load/store data in config?
@Laogeodritt
Copy link
Collaborator Author

Laogeodritt commented Mar 8, 2018

Still todo:

  • Abstract base class with deserialise/serialise hooks to load/store data in config?
  • Universal config elements - output channel, test channel, etc.? ('discord' section of user cfg)
  • Abstraction of config section? get_config or similar that abstracts away the section name + __init__ hook for the section name?

Extracted:

  • State config - Post-command hooks and some kind of "dirty data" flag to automatically save after a command is processed? (Depends on discord.py 1.0.0) [moved to Auto-save state.json #84]

@Laogeodritt Laogeodritt modified the milestones: Backlog, v2.1 Mar 20, 2018
@Laogeodritt Laogeodritt added this to To do in KazTron v2.1 via automation Mar 20, 2018
@Laogeodritt Laogeodritt moved this from To do to In progress in KazTron v2.1 Mar 21, 2018
@Laogeodritt Laogeodritt moved this from In progress to Deferred in KazTron v2.1 Apr 5, 2018
@Laogeodritt Laogeodritt modified the milestones: v2.1, Backlog Apr 5, 2018
@Laogeodritt Laogeodritt modified the milestones: Backlog, v2.2 Apr 17, 2018
@Laogeodritt Laogeodritt added this to To do in KazTron v2.2 via automation Apr 17, 2018
@Laogeodritt Laogeodritt removed this from Deferred in KazTron v2.1 Apr 17, 2018
@Laogeodritt Laogeodritt moved this from To do to In progress in KazTron v2.2 Jun 21, 2018
@Laogeodritt Laogeodritt mentioned this issue Jun 24, 2018
@Laogeodritt Laogeodritt moved this from In progress to Unreleased in KazTron v2.2 Jun 24, 2018
Laogeodritt added a commit to Laogeodritt/KazTron that referenced this issue Jun 24, 2018
@Laogeodritt Laogeodritt moved this from Unreleased to Done in KazTron v2.2 Aug 13, 2018
@Laogeodritt Laogeodritt mentioned this issue Sep 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
KazTron v2.2
  
Done
Development

No branches or pull requests

1 participant