Closed poulad closed 4 months ago
Is this still an issue? There is no signs of reproducing this behaviour for more than a year.
I'd leave it open because there's still a probability of facing it.
As of today CallbackQuery has a really vague description of this behaviour:
Field | Type | Description |
---|---|---|
message | Message | Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old |
How old is "too old"? Which properties fit "message content" description? To fix this we could either introduce MessageInQuestion
class (where all properties are optional), or make all properties of Message
class optional (and it won't look good).
Solved with v21.*
Undefined date will have default
value as we are no longer enforcing JsonRequired fields.
Bug Report
Property
Message.Date
might not exist for the old callback query updates. See theupdate.callback_query.message
descriptions.https://github.com/TelegramBots/Telegram.Bot/blob/85134a4b5f09de4bef4306aa44d708c202b31f31/src/Telegram.Bot/Types/Message.cs#L34-L36
Steps to reproduce
Try to deserialize this update.
Expected behavior
JSON is deserialized into
u
object.Actual behavior
Throws serialization exception:
Environment data
NuGet Package Version: 14.10.0