From 826a9541a44121bafe4ce19f2cd4a68fcabb2384 Mon Sep 17 00:00:00 2001 From: jonz94 Date: Fri, 27 Dec 2024 13:41:30 +0800 Subject: [PATCH] fix(sendMessage): Handle `RunAttestationCommand` in response actions (#859) * fix(sendMessage): Handle `RunAttestationCommand` in response actions Handle the case when `RunAttestationCommand` is included in the `sendMessage()` response actions. * style: trim trailing whitespace --- src/parser/youtube/LiveChat.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/parser/youtube/LiveChat.ts b/src/parser/youtube/LiveChat.ts index 291f66ca..0420980c 100644 --- a/src/parser/youtube/LiveChat.ts +++ b/src/parser/youtube/LiveChat.ts @@ -5,6 +5,7 @@ import { InnertubeError, Platform, u8ToBase64 } from '../../utils/Utils.js'; import { LiveChatContinuation, Parser } from '../index.js'; import SmoothedQueue from './SmoothedQueue.js'; +import RunAttestationCommand from '../classes/commands/RunAttestationCommand.js'; import AddChatItemAction from '../classes/livechat/AddChatItemAction.js'; import UpdateDateTextAction from '../classes/livechat/UpdateDateTextAction.js'; import UpdateDescriptionAction from '../classes/livechat/UpdateDescriptionAction.js'; @@ -251,7 +252,7 @@ export default class LiveChat extends EventEmitter { * Sends a message. * @param text - Text to send. */ - async sendMessage(text: string): Promise> { + async sendMessage(text: string): Promise> { const writer = LiveMessageParams.encode({ params: { ids: { @@ -259,7 +260,7 @@ export default class LiveChat extends EventEmitter { channelId: this.#channel_id } }, - number0: 1, + number0: 1, number1: 4 }); @@ -276,7 +277,7 @@ export default class LiveChat extends EventEmitter { if (!response.actions) throw new InnertubeError('Unexpected response from send_message', response); - return response.actions.array().as(AddChatItemAction); + return response.actions.array().as(AddChatItemAction, RunAttestationCommand); } /**