ayrat555 / frankenstein

Telegram bot API client for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unknown entity types are not accepted

kriomant opened this issue · comments

Telegram Bot API is constantly changing. However, old clients and libraries continue to work without update. So until you want to use new features, you may not bother, you bot just works. I suppose protocol version is sent by client or something like that.

BUT. It seems that new entity types are added to all protocol versions simultaneously. So one day some user sends message containing new entity type to bot, frankenstein fails to parse it and your bot is gone!

I propose to: make special EntityType variant, like Unknown(name: String), and don't fail when unknown entity type is received.

This might be interesting for some enum types. Structs should be unaffected by this I think?

I have been using Frankenstein for half a year now, and the only problem I had was new entities.
I tried to find any formal note about them in Telegram Bot API spec (like "may be added without bumping protocol version"), but didn't find anything. So I'm not sure this is the only enum which may be changed unexpectedly, but this one definitely changes often enough.
There were never any problems with structs, e.g. recent change in forwarded messages representation didn't break my bot based on older version of library.

for me it makes sense. I experienced the same problem multiple times.

would it be possible to create a pr?

Any news?