Closed LordFlashmeow closed 3 years ago
Maybe we can hold the users' hand a little and give them warnings by making the Event models subclasses of WorldEvent and CharacterEvent, and then a function to verify the subscription before sending it.
Something like that, yeah - I've started a draft of merging our two implementations locally, but I got a bit side-tracked trying to resolve all the partially-imported-modules needing to talk to each other (models require bases, bases require models to validate triggers, triggers now take these models as arguments...).
Not too happy with my work-in-progress, but I'll make a PR tomorrow once I found a solution for the import shenanigans.
I chose to make a util file that didn't import from anything and move what I could into there. After that I ended up consolidating a bunch of files to cut down on imports. Definitely headache-inducing!
Closing this PR as it has been integrated into the larger #43 refactor.
Thank you again for this request; the commits got buried a bit behind an larger restructuring, but the event portion of that draft is now very similar to your original work here.
I went all-out on implementing pydantic models for the websocket responses. I thought it was a cool idea to let pydantic parse the messages, starting with the raw payload text all the way to the models.
Let me know your thoughts and if there's anything you'd like to keep.