Skip to content

fix(sendMessage): Handle RunAttestationCommand in response actions#859

Merged
LuanRT merged 2 commits intoLuanRT:mainfrom
jonz94:fix-sendMessage
Dec 27, 2024
Merged

fix(sendMessage): Handle RunAttestationCommand in response actions#859
LuanRT merged 2 commits intoLuanRT:mainfrom
jonz94:fix-sendMessage

Conversation

@jonz94
Copy link
Contributor

@jonz94 jonz94 commented Dec 26, 2024

Fixes #853

Handle the case when RunAttestationCommand is included in the sendMessage() response actions.

Example response data:

{
  "responseContext": {
    /* truncated */
  },
  "actions": [
    {
      "clickTrackingParams": "IhMIyYG6_ezFigMVXfJMAh0nvgZN",
      "addChatItemAction": {
        "item": {
          "liveChatTextMessageRenderer": {
            "message": {
              "runs": [
                {
                  "text": "hi"
                }
              ]
            },
            "authorName": {
              "simpleText": "YOLO9487"
            },
            "authorPhoto": {
              "thumbnails": [
                {
                  "url": "https://yt4.ggpht.com/--MMwR8If9UU6Fk0ldP817V-HIC8MfIcbfncUoXYKWehJ1pDHev5OvRj4mtS-0yStMUQ28xj7Xs=s32-c-k-c0x00ffffff-no-rj",
                  "width": 32,
                  "height": 32
                },
                {
                  "url": "https://yt4.ggpht.com/--MMwR8If9UU6Fk0ldP817V-HIC8MfIcbfncUoXYKWehJ1pDHev5OvRj4mtS-0yStMUQ28xj7Xs=s64-c-k-c0x00ffffff-no-rj",
                  "width": 64,
                  "height": 64
                }
              ]
            },
            "contextMenuEndpoint": {
              "clickTrackingParams": "IhMIyYG6_ezFigMVXfJMAh0nvgZN",
              "commandMetadata": {
                "webCommandMetadata": {
                  "ignoreNavigation": true
                }
              },
              "liveChatItemContextMenuEndpoint": {
                "params": "Q2g0S0hBb2FRMHRUT1haMk0zTjRXVzlFUm1FM1FuZG5VV1JCV1VsdkxXY2FLU29uQ2hoVlEwcFRWREUzYVdzMFExOW5UemMyTkZBMmRGRndNR2NTQzNKclVrWkNXbkJ5WTJkQklBRW9CRElhQ2hoVlF6TmhiMjA0VnpGMVNreHlXVmxDT1c4eFVYRjZUSGM0QWtnQVVBRSUzRA=="
              }
            },
            "id": "ChwKGkNLUzl2djNzeFlvREZhN0J3Z1FkQVlJby1n",
            "timestampUsec": "1735230401521637",
            "authorExternalChannelId": "UC3aom8W1uJLrYYB9o1QqzLw",
            "contextMenuAccessibility": {
              "accessibilityData": {
                "label": "Chat actions"
              }
            },
            "trackingParams": "IhMIyYG6_ezFigMVXfJMAh0nvgZN"
          }
        },
        "clientId": "6f566a92-3741-40a9-a8ad-cc53afef8cba"
      }
    },
    {
      "clickTrackingParams": "IhMIyYG6_ezFigMVXfJMAh0nvgZN",
      "runAttestationCommand": {
        "ids": [
          {
            "commentId": "Ugy6JBI69PejvZkmJ1x4AaABDqgB3qi7iAI"
          },
          {
            "encryptedVideoId": "rkRFBZprcgA"
          },
          {
            "externalChannelId": "UCJST17ik4C_gO764P6tQp0g"
          }
        ],
        "engagementType": "ENGAGEMENT_TYPE_LIVE_CHAT_COMMENT"
      }
    }
  ]
}

Handle the case when `RunAttestationCommand` is included in the
`sendMessage()` response actions.
@LuanRT LuanRT merged commit 826a954 into LuanRT:main Dec 27, 2024
@jonz94 jonz94 deleted the fix-sendMessage branch December 27, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v12.2.0 ParsingError: Expected node of any type AddChatItemAction, got RunAttestationCommand

2 participants