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

Update attachment type sticker (error: path '[0].sticker.animation_url') #1629

Closed
ivanmem opened this issue Jan 17, 2025 · 1 comment
Closed

Comments

@ivanmem
Copy link
Contributor

ivanmem commented Jan 17, 2025

ВК сделали анимированные стикеры. VkNet падает при парсинге сообщения с ними с ошибкой Could not convert string to boolean: https://vk.com/sticker/3-91361.json. Path '[0].sticker.animation_url', line 98, position 70.
Вот пример события message_new:

{
  "group_id": 123,
  "type": "message_new",
  "event_id": "123",
  "v": "5.131",
  "object": {
    "client_info": {
      "button_actions": [
        "text",
        "vkpay",
        "open_app",
        "location",
        "open_link",
        "open_photo",
        "callback",
        "intent_subscribe",
        "intent_unsubscribe"
      ],
      "keyboard": true,
      "inline_keyboard": true,
      "carousel": true,
      "lang_id": 0
    },
    "message": {
      "date": 1737121975,
      "from_id": 1234567,
      "id": 0,
      "version": 11012544,
      "out": 0,
      "reply_message": {
        "date": 1737121847,
        "from_id": 1234567,
        "text": "",
        "reply_message": {
          "date": 1737121831,
          "from_id": 1234567,
          "text": "",
          "attachments": [
            {
              "type": "sticker",
              "sticker": {
                "inner_type": "base_sticker_new",
                "sticker_id": 91361,
                "product_id": 1950,
                "images": [
                  {
                    "url": "[https://vk.com/sticker/1-91361-64"](https://vk.com/sticker/1-91361-64%22),
                    "width": 64,
                    "height": 64
                  },
                  {
                    "url": "[https://vk.com/sticker/1-91361-128"](https://vk.com/sticker/1-91361-128%22),
                    "width": 128,
                    "height": 128
                  },
                  {
                    "url": "[https://vk.com/sticker/1-91361-256"](https://vk.com/sticker/1-91361-256%22),
                    "width": 256,
                    "height": 256
                  },
                  {
                    "url": "[https://vk.com/sticker/1-91361-352"](https://vk.com/sticker/1-91361-352%22),
                    "width": 352,
                    "height": 352
                  },
                  {
                    "url": "[https://vk.com/sticker/1-91361-512"](https://vk.com/sticker/1-91361-512%22),
                    "width": 512,
                    "height": 512
                  }
                ],
                "images_with_background": [
                  {
                    "url": "[https://vk.com/sticker/1-91361-64"](https://vk.com/sticker/1-91361-64%22),
                    "width": 64,
                    "height": 64
                  },
                  {
                    "url": "[https://vk.com/sticker/1-91361-128"](https://vk.com/sticker/1-91361-128%22),
                    "width": 128,
                    "height": 128
                  },
                  {
                    "url": "[https://vk.com/sticker/1-91361-256"](https://vk.com/sticker/1-91361-256%22),
                    "width": 256,
                    "height": 256
                  },
                  {
                    "url": "[https://vk.com/sticker/1-91361-352"](https://vk.com/sticker/1-91361-352%22),
                    "width": 352,
                    "height": 352
                  },
                  {
                    "url": "[https://vk.com/sticker/1-91361-512"](https://vk.com/sticker/1-91361-512%22),
                    "width": 512,
                    "height": 512
                  }
                ],
                "animation_url": "[https://vk.com/sticker/3-91361.json"](https://vk.com/sticker/3-91361.json%22),
                "is_allowed": false
              }
            }
          ],
          "conversation_message_id": 3260205,
          "id": 20039089,
          "peer_id": 2000000339
        },
        "attachments": [
          {
            "type": "sticker",
            "sticker": {
              "inner_type": "base_sticker_new",
              "sticker_id": 76043,
              "product_id": 1609,
              "images": [
                {
                  "url": "[https://vk.com/sticker/1-76043-64"](https://vk.com/sticker/1-76043-64%22),
                  "width": 64,
                  "height": 64
                },
                {
                  "url": "[https://vk.com/sticker/1-76043-128"](https://vk.com/sticker/1-76043-128%22),
                  "width": 128,
                  "height": 128
                },
                {
                  "url": "[https://vk.com/sticker/1-76043-256"](https://vk.com/sticker/1-76043-256%22),
                  "width": 256,
                  "height": 256
                },
                {
16:52


"url": "[https://vk.com/sticker/1-76043-352"](https://vk.com/sticker/1-76043-352%22),
                  "width": 352,
                  "height": 352
                },
                {
                  "url": "[https://vk.com/sticker/1-76043-512"](https://vk.com/sticker/1-76043-512%22),
                  "width": 512,
                  "height": 512
                }
              ],
              "images_with_background": [
                {
                  "url": "[https://vk.com/sticker/1-76043-64"](https://vk.com/sticker/1-76043-64%22),
                  "width": 64,
                  "height": 64
                },
                {
                  "url": "[https://vk.com/sticker/1-76043-128"](https://vk.com/sticker/1-76043-128%22),
                  "width": 128,
                  "height": 128
                },
                {
                  "url": "[https://vk.com/sticker/1-76043-256"](https://vk.com/sticker/1-76043-256%22),
                  "width": 256,
                  "height": 256
                },
                {
                  "url": "[https://vk.com/sticker/1-76043-352"](https://vk.com/sticker/1-76043-352%22),
                  "width": 352,
                  "height": 352
                },
                {
                  "url": "[https://vk.com/sticker/1-76043-512"](https://vk.com/sticker/1-76043-512%22),
                  "width": 512,
                  "height": 512
                }
              ],
              "animation_url": "[https://vk.com/sticker/3-76043.json"](https://vk.com/sticker/3-76043.json%22),
              "is_allowed": false
            }
          }
        ],
        "conversation_message_id": 123,
        "id": 123,
        "peer_id": 123
      },
      "fwd_messages": [],
      "important": false,
      "is_hidden": false,
      "attachments": [
        {
          "type": "sticker",
          "sticker": {
            "inner_type": "base_sticker_new",
            "sticker_id": 76049,
            "product_id": 1609,
            "images": [
              {
                "url": "[https://vk.com/sticker/1-76049-64"](https://vk.com/sticker/1-76049-64%22),
                "width": 64,
                "height": 64
              },
              {
                "url": "[https://vk.com/sticker/1-76049-128"](https://vk.com/sticker/1-76049-128%22),
                "width": 128,
                "height": 128
              },
              {
                "url": "[https://vk.com/sticker/1-76049-256"](https://vk.com/sticker/1-76049-256%22),
                "width": 256,
                "height": 256
              },
              {
                "url": "[https://vk.com/sticker/1-76049-352"](https://vk.com/sticker/1-76049-352%22),
                "width": 352,
                "height": 352
              },
              {
                "url": "[https://vk.com/sticker/1-76049-512"](https://vk.com/sticker/1-76049-512%22),
                "width": 512,
                "height": 512
              }
            ],
            "images_with_background": [
              {
                "url": "[https://vk.com/sticker/1-76049-64"](https://vk.com/sticker/1-76049-64%22),
                "width": 64,
                "height": 64
              },
              {
                "url": "[https://vk.com/sticker/1-76049-128"](https://vk.com/sticker/1-76049-128%22),
                "width": 128,
                "height": 128
              },
              {
                "url": "[https://vk.com/sticker/1-76049-256"](https://vk.com/sticker/1-76049-256%22),
                "width": 256,
                "height": 256
              },
              {
                "url": "[https://vk.com/sticker/1-76049-352"](https://vk.com/sticker/1-76049-352%22),
                "width": 352,
                "height": 352
              },
              {
                "url": "[https://vk.com/sticker/1-76049-512"](https://vk.com/sticker/1-76049-512%22),
                "width": 512,
                "height": 512
              }
            ],
            "animation_url": "[https://vk.com/sticker/3-76049.json"](https://vk.com/sticker/3-76049.json%22),
            "is_allowed": false
          }
        }
      ],
      "conversation_message_id": 123,
      "text": "",
      "is_unavailable": true,
      "peer_id": 2000001234,
      "random_id": 0
    }
  }
}
```»
@ivanmem ivanmem changed the title Update attachment type sticker Update attachment type sticker (error: path '[0].sticker.animation_url') Jan 17, 2025
@ivanmem
Copy link
Contributor Author

ivanmem commented Jan 18, 2025

Кажется ошибка была связана с неверным типом в объекте. Поправил в #1630

@ivanmem ivanmem closed this as completed Jan 18, 2025
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