telexide
telexide copied to clipboard
data did not match any variant of untagged enum StickerType
If someone sends my bot a sticker, my bot crashes with this error: data did not match any variant of untagged enum StickerType
. I tried to debug this error and took a look at the raw client polling update json and it looked like this:
[
{
"message": {
"chat": {
"first_name": "Adri",
"id": -,
"type": "private",
"username": "adridoesthings"
},
"date": 1706644708,
"forward_date": 1706605436,
"forward_from": {
"first_name": "Adri",
"id": -,
"is_bot": false,
"language_code": "en",
"username": "adridoesthings"
},
"forward_origin": {
"date": 1706605436,
"sender_user": {
"first_name": "Adri",
"id": -,
"is_bot": false,
"language_code": "en",
"username": "adridoesthings"
},
"type": "user"
},
"from": {
"first_name": "Adri",
"id": -,
"is_bot": false,
"language_code": "en",
"username": "adridoesthings"
},
"message_id": 1437,
"sticker": {
"file_id": "...",
"file_size": 37730,
"file_unique_id": "...",
"height": 308,
"is_animated": false,
"is_video": false,
"thumb": {
"file_id": "...",
"file_size": 16402,
"file_unique_id": "...",
"height": 192,
"width": 320
},
"thumbnail": {
"file_id": "...",
"file_size": 16402,
"file_unique_id": "...",
"height": 192,
"width": 320
},
"type": "regular",
"width": 512
}
},
"update_id": 64883052
}
]
so the type
of the sticker is regular
. And then I took a look to your StickerType
and saw that the variant regular
is covered: https://github.com/CalliEve/telexide/blob/3b6af18318d316c3ea1118003114ff56ca4fa95d/src/model/stickers.rs#L127. I really don't know where this error comes from, but it's possible to "fix" this bug, by adding an Unknown(String)
variant to the enum. Do you have an idea where this error comes from?