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
Implement configuration checking #9
Comments
Here's an incomplete implementation we can use as an example: In configs.py: def verify_config(config: dict) -> None:
# Initialize keys expected to be in the config.json file.
valid_keys = [
"bot_prefix",
]
for key in valid_keys:
if key not in list(config.keys()):
raise KeyError(f"{key} is missing from the configuration file.") This can also be a static method. Ideally, the program should immediately fail if the config file is bad or invalid. If it does fail, it would be nice to have a more useful error message, like instruction or a tip or whatever. It's worth noting that, in this example, the function takes a dictionary as an argument. The dictionary object is the parsed JSON file and is passed from the |
@huenique I wanna work on this issue, can you assign this issue to me, I can start looking at it first. |
@avinash-tiwari it's yours! |
ill take this up |
@ooliver1 go ahead 🍻 |
Lmao I may have done it pretty good |
To some degree, Dayong allows high-level customization through the config.json file. Although we only use it now to change how we experience commands and interactions, it's likely to cause erroneous behaviors, especially as the config file becomes larger as we add more features that rely on it.
Configuration checking helps us avoid any problems that may arise from using the config.json file by first verifying that software requirements are met. It's basically just a process that tells us whether a configuration is good or bad. Dayong does not have that kind of functionality yet.
The text was updated successfully, but these errors were encountered: