From 8cdbf5da66287831b2f147f1bef4cf7ec15f02a5 Mon Sep 17 00:00:00 2001 From: jonz94 Date: Fri, 27 Dec 2024 00:55:07 +0800 Subject: [PATCH 1/2] fix(sendMessage): Handle `RunAttestationCommand` in response actions Handle the case when `RunAttestationCommand` is included in the `sendMessage()` response actions. --- src/parser/youtube/LiveChat.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/parser/youtube/LiveChat.ts b/src/parser/youtube/LiveChat.ts index 291f66ca5..1e882306d 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: { @@ -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); } /** From 0199bdf5202ffa2fd12e073c15946c84933a227d Mon Sep 17 00:00:00 2001 From: jonz94 Date: Fri, 27 Dec 2024 01:01:24 +0800 Subject: [PATCH 2/2] style: trim trailing whitespace --- src/parser/youtube/LiveChat.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/youtube/LiveChat.ts b/src/parser/youtube/LiveChat.ts index 1e882306d..0420980ce 100644 --- a/src/parser/youtube/LiveChat.ts +++ b/src/parser/youtube/LiveChat.ts @@ -260,7 +260,7 @@ export default class LiveChat extends EventEmitter { channelId: this.#channel_id } }, - number0: 1, + number0: 1, number1: 4 });