chris124567 / zoomer

Chat bots (& more) for Zoom by figuring out their websocket protocol
MIT License
57 stars 6 forks source link

Clean up message API a bit #1

Closed lukechampine closed 3 years ago

lukechampine commented 3 years ago

This PR changes the API of session.MakeWebsocketConnection so that the caller can type-switch on the message, rather than switching on the Evt field and decoding the JSON themselves.

I also tried to clean up the mapping from Evt to Go type via a bit of reflection, but I wasn't able to test it locally, so...fingers crossed it works at runtime. 😬

chris124567 commented 3 years ago

Thanks! This is really good. I knew there was a more elegant way to handle all the message types but didn't know enough about reflect to do it myself. I tested it and it worked perfectly. Merging :smile: