Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Need to work out a more consistent and reliable method to import and pass structures, util functions and handlers #5

Closed
kevalpithadiya opened this issue Feb 27, 2021 · 4 comments · Fixed by #8
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed
Projects

Comments

@kevalpithadiya
Copy link
Collaborator

I was trying to work on implementing the User class in the bot but I kept running into circular dependencies. This was even more confusing to figure out because of the mess of require functions in each file. Thus, we need to find a better way to pass and import these things from files.

I was thinking about initializing the structures in app.js by requiring their modules. Then passing them down through the Client. So we can access them directly through discord.js based classes and also import them directly from a single file when needed. However I'm kind of lost on how we should initialize the structures, as many depend on each other.

Or suggest any other method to avoid circular dependencies crashing the bot.

@kevalpithadiya kevalpithadiya added bug Something isn't working help wanted Extra attention is needed labels Feb 27, 2021
@kevalpithadiya
Copy link
Collaborator Author

Perhaps it's better to even make a custom class which extends the CommandoClient. And we can make a PickupsManager and UserManager to interact with and manage cached games and users. We can define the handlers and utils as methods which can directly have access to the Classes instead of having to import stuff. Overall, it will be a more consistent implementation. Having to import things everywhere is really janky.

@PsiAphex
Copy link
Collaborator

Sounds good

@kevalpithadiya kevalpithadiya self-assigned this Mar 1, 2021
@kevalpithadiya
Copy link
Collaborator Author

Progress - Defined Basic Structures for PugClient (Extension of CommandoClient). Now it's time to work on updating the existing structures (Pickups and Game) to work with the new Client.

@kevalpithadiya
Copy link
Collaborator Author

Progress - Updated Pickups and Game structure. Needs testing.

@Jytesh Jytesh added this to Done in Todo Mar 2, 2021
@Jytesh Jytesh moved this from Done to In progress in Todo Mar 2, 2021
@Jytesh Jytesh mentioned this issue Mar 4, 2021
@Jytesh Jytesh closed this as completed in #8 Mar 4, 2021
Todo automation moved this from In progress to Done Mar 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
Todo
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants