Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AdriDevelopsThings opened this issue Jan 30, 2024 · 0 comments
Open

Comments

@AdriDevelopsThings
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant