Skip to content

data did not match any variant of untagged enum StickerType #37

@AdriDevelopsThings

Description

@AdriDevelopsThings

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:

#[serde(rename = "regular")]
. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions