Telegramium-9.74.0
OpenEnum
The Telegram Bot API is not versioned, which means bots and libraries must try to be forward-compatible. Specifically for enumerations, this implies that bots should always anticipate new values being added. Handling these values depends on the bot's business logic. Some apps may simply ignore unknown values, while others might respond with "This message is not supported", save the message for manual processing later, or throw a request handling error.
Telegramium introduces OpenEnum
, a wrapper for Telegram Bot API enumerations with two cases: Known
and Unknown
. This type allows unknown values to be explicitly handled (similar to Option
or Either
), enabling bots using Telegramium to be more robust, improve error handling, and degrade gracefully in light of frequent Telegram Bot API updates.