PaulSonOfLars / gotgbot

Autogenerated Go wrapper for the telegram API. Inspired by the python-telegram-bot library.
MIT License
469 stars 107 forks source link

Improve code generation #87

Closed PaulSonOfLars closed 1 year ago

PaulSonOfLars commented 1 year ago

What

Improve code generation to avoid multiple hardcoded values, focusing on behaviour rather than type names.

Eg, instead of hardcoding that InputMedia requires an InputParams method, we can work it out by knowing that all InputMedia types contain InputFiles, and so will have data.

This also removes file.Get, which was a pointless helper method which just got the same file from an existing file, and so achieved nothing. Bad codegen there.

Impact