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

Configloader Rework #31

Open
Gregor7008 opened this issue Jun 5, 2022 · 5 comments
Open

Configloader Rework #31

Gregor7008 opened this issue Jun 5, 2022 · 5 comments
Assignees
Labels
Milestone

Comments

@Gregor7008
Copy link
Owner

Implementation of background system to, if config files are changed whilst the bot is operating, update all the old configuration files without the bot breaking.
Could be done by saving all the old keys and value-data-types, trying to get the updated versions and on an error update the config files whilst returning castet values so it matches the updated system for now.

@Gregor7008 Gregor7008 self-assigned this Jun 5, 2022
@Gregor7008 Gregor7008 added the Suggestion Idea or suggestion label Jun 5, 2022
@Gregor7008 Gregor7008 added this to the V2.0-alpha milestone Jun 5, 2022
@Gregor7008 Gregor7008 moved this to Ideas / Suggestions / Bugs in Butler George V2 Jul 29, 2022
@Gregor7008
Copy link
Owner Author

Gregor7008 commented Aug 4, 2022

Simple concept:

  1. Save example config file with default values
  2. Add xml or json file for declaration of changes
  3. If Configloader throws error because key wasn't found, check config completely and enforce all changes declared in file from 2.

Edit 1: I added a DataNotFoundException in the most recent commit which will be thrown, whenever such a "key not found" error occurs. Didn't implement it yet and will not until the whole rework is done, but it's here to stay - maybe. I might also add a simple static "version" key to every class implementing DataContainer, that will result in a check being run on every data file containing a version string that doesnt match the currently defined version string within the class file...

@Gregor7008 Gregor7008 modified the milestones: V2.0-alpha, V3.0-alpha Sep 3, 2022
@Gregor7008
Copy link
Owner Author

Moved to V3 as this will be done with a complete makeover of the configuration file system.

@Gregor7008 Gregor7008 moved this to Ideas / Suggestions / Bugs in Butler George V3 Sep 3, 2022
@Gregor7008 Gregor7008 changed the title Config-File structure update system Configloader Rework Sep 6, 2022
@Gregor7008 Gregor7008 moved this to In Developement in Butler George V2 Oct 1, 2022
@Gregor7008 Gregor7008 modified the milestones: V3.0-alpha , V2.0-alpha Oct 1, 2022
@Gregor7008
Copy link
Owner Author

Moved to V2 once again, as this ConfigLoader Rework is needed so badly - Just look at the new ModMail system that was implemented in V2 and how simple it would have looked if the ConfigLoader wouldnt just return JSONObjects but full qualified DataObjects specified for the type of data they contain...

@Gregor7008 Gregor7008 moved this from In Developement to Partly Done in Butler George V2 Nov 23, 2022
@Gregor7008
Copy link
Owner Author

Gregor7008 commented Nov 25, 2022

Quick update on what still has to be done:

  • Implementation of the 'GiveawayData.class' including any message building and interaction management
  • Transfer of the J2C-Tool functions from 'EventProcessor.class' to the 'Join2CreateChannelData.class'
  • Implementation of the '.buildEndEmbed()' function in 'PollData.class'
  • Implementation of the 'ReactionRoleData.class'
  • Implementation of the 'WarningData.class' including a notification to the 'ModController.class' whenever one is added
  • Adaption of said 'ModController.class' to a new event based system instead of the old 5-minute-check-cycle system
  • Merging of the old 'ConfigLoader.class' and the 'ConfigManager.class' to a 'DataLoader.class'
  • Adaption of Butler George to the new 'DataLoader.class'

Yes, it doesn't only seem like it's a lot, but I thought I might put an update here - also just to calm myself down 😅!

Gregor7008 added a commit that referenced this issue Nov 30, 2022
...and updated data classes according to new comment on #31
@Gregor7008
Copy link
Owner Author

Alright, I got bad news: I think we have to code everything again, as data should be stored in ID form and not in some member object, that might become invalid over time. Imagine this: We save a members java object on configuration, this member deletes his account and we try to interact with that saved java object: I do not want to imagine what would happen, if this would happen so we gotta prevent it, by switching to IDs and retrieving the user/member/guild/channel/message every time we need the object. This would happen within the data classes still, but it means rewriting of already completed code...

Gregor7008 added a commit that referenced this issue Dec 2, 2022
This results from a comment I made on #31 in which I explained the problem with saving objects such as Guilds, Roles, Users, Members and so on: They might get deleted, whilst the bot has saved them. In the future the bot will therefore save ids instead of those objects and convert these ids to objects as soon as they are requested from one of the data objects defined within the data classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Development
Development

No branches or pull requests

1 participant