[youtubei.js](../../../../README.md) / [YTNodes](../README.md) / CommentView # Class: CommentView Defined in: [src/parser/classes/comments/CommentView.ts:29](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L29) ## Extends - [`YTNode`](../../Helpers/classes/YTNode.md) ## Constructors ### Constructor > **new CommentView**(`data`): `CommentView` Defined in: [src/parser/classes/comments/CommentView.ts:70](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L70) #### Parameters ##### data [`RawNode`](../../../../type-aliases/RawNode.md) #### Returns `CommentView` #### Overrides [`YTNode`](../../Helpers/classes/YTNode.md).[`constructor`](../../Helpers/classes/YTNode.md#constructor) ## Properties ### author? > `optional` **author**: [`Author`](../../Misc/classes/Author.md) Defined in: [src/parser/classes/comments/CommentView.ts:62](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L62) *** ### author\_is\_channel\_owner? > `optional` **author\_is\_channel\_owner**: `boolean` Defined in: [src/parser/classes/comments/CommentView.ts:47](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L47) *** ### comment\_id > **comment\_id**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:41](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L41) *** ### content? > `optional` **content**: [`Text`](../../Misc/classes/Text.md) Defined in: [src/parser/classes/comments/CommentView.ts:45](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L45) *** ### creator\_thumbnail\_url? > `optional` **creator\_thumbnail\_url**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:48](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L48) *** ### dislike\_active\_tooltip? > `optional` **dislike\_active\_tooltip**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:55](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L55) *** ### dislike\_command? > `optional` **dislike\_command**: [`NavigationEndpoint`](NavigationEndpoint.md) Defined in: [src/parser/classes/comments/CommentView.ts:35](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L35) *** ### dislike\_inactive\_tooltip? > `optional` **dislike\_inactive\_tooltip**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:56](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L56) *** ### heart\_active\_tooltip? > `optional` **heart\_active\_tooltip**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:57](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L57) *** ### is\_disliked? > `optional` **is\_disliked**: `boolean` Defined in: [src/parser/classes/comments/CommentView.ts:65](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L65) *** ### is\_hearted? > `optional` **is\_hearted**: `boolean` Defined in: [src/parser/classes/comments/CommentView.ts:66](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L66) *** ### is\_liked? > `optional` **is\_liked**: `boolean` Defined in: [src/parser/classes/comments/CommentView.ts:64](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L64) *** ### is\_member? > `optional` **is\_member**: `boolean` Defined in: [src/parser/classes/comments/CommentView.ts:60](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L60) *** ### is\_pinned > **is\_pinned**: `boolean` Defined in: [src/parser/classes/comments/CommentView.ts:42](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L42) *** ### keys > **keys**: `CommentKeys` Defined in: [src/parser/classes/comments/CommentView.ts:43](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L43) *** ### like\_active\_tooltip? > `optional` **like\_active\_tooltip**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:53](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L53) *** ### like\_button\_a11y? > `optional` **like\_button\_a11y**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:49](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L49) *** ### like\_command? > `optional` **like\_command**: [`NavigationEndpoint`](NavigationEndpoint.md) Defined in: [src/parser/classes/comments/CommentView.ts:34](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L34) *** ### like\_count? > `optional` **like\_count**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:50](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L50) *** ### like\_count\_a11y? > `optional` **like\_count\_a11y**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:52](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L52) *** ### like\_count\_liked? > `optional` **like\_count\_liked**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:51](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L51) *** ### like\_inactive\_tooltip? > `optional` **like\_inactive\_tooltip**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:54](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L54) *** ### member\_badge? > `optional` **member\_badge**: `MemberBadge` Defined in: [src/parser/classes/comments/CommentView.ts:61](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L61) *** ### prepare\_account\_command? > `optional` **prepare\_account\_command**: [`NavigationEndpoint`](NavigationEndpoint.md) Defined in: [src/parser/classes/comments/CommentView.ts:39](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L39) *** ### published\_time? > `optional` **published\_time**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:46](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L46) *** ### reply\_command? > `optional` **reply\_command**: [`NavigationEndpoint`](NavigationEndpoint.md) Defined in: [src/parser/classes/comments/CommentView.ts:38](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L38) *** ### reply\_count? > `optional` **reply\_count**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:58](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L58) *** ### reply\_count\_a11y? > `optional` **reply\_count\_a11y**: `string` Defined in: [src/parser/classes/comments/CommentView.ts:59](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L59) *** ### type > `readonly` **type**: `string` Defined in: [src/parser/helpers.ts:8](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/helpers.ts#L8) #### Inherited from [`YTNode`](../../Helpers/classes/YTNode.md).[`type`](../../Helpers/classes/YTNode.md#type) *** ### undislike\_command? > `optional` **undislike\_command**: [`NavigationEndpoint`](NavigationEndpoint.md) Defined in: [src/parser/classes/comments/CommentView.ts:37](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L37) *** ### unlike\_command? > `optional` **unlike\_command**: [`NavigationEndpoint`](NavigationEndpoint.md) Defined in: [src/parser/classes/comments/CommentView.ts:36](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L36) *** ### voice\_reply\_container? > `optional` **voice\_reply\_container**: [`VoiceReplyContainerView`](VoiceReplyContainerView.md) \| `null` Defined in: [src/parser/classes/comments/CommentView.ts:68](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L68) *** ### type > `static` **type**: `string` = `'CommentView'` Defined in: [src/parser/classes/comments/CommentView.ts:30](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L30) #### Overrides [`YTNode`](../../Helpers/classes/YTNode.md).[`type`](../../Helpers/classes/YTNode.md#type-1) ## Methods ### applyMutations() > **applyMutations**(`comment?`, `toolbar_state?`, `toolbar_surface?`, `comment_surface?`): `void` Defined in: [src/parser/classes/comments/CommentView.ts:85](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L85) #### Parameters ##### comment? [`RawNode`](../../../../type-aliases/RawNode.md) ##### toolbar\_state? [`RawNode`](../../../../type-aliases/RawNode.md) ##### toolbar\_surface? [`RawNode`](../../../../type-aliases/RawNode.md) ##### comment\_surface? [`RawNode`](../../../../type-aliases/RawNode.md) #### Returns `void` *** ### as() > **as**\<`T`, `K`\>(...`types`): `InstanceType`\<`K`\[`number`\]\> Defined in: [src/parser/helpers.ts:29](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/helpers.ts#L29) Cast to one of the given types. #### Type Parameters ##### T `T` *extends* [`YTNode`](../../Helpers/classes/YTNode.md) ##### K `K` *extends* [`YTNodeConstructor`](../../Helpers/interfaces/YTNodeConstructor.md)\<`T`\>[] #### Parameters ##### types ...`K` The types to cast to #### Returns `InstanceType`\<`K`\[`number`\]\> The node cast to one of the given types #### Throws If the node is not of the given type #### Inherited from [`YTNode`](../../Helpers/classes/YTNode.md).[`as`](../../Helpers/classes/YTNode.md#as) *** ### dislike() > **dislike**(): `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> Defined in: [src/parser/classes/comments/CommentView.ts:167](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L167) Dislikes the comment. #### Returns `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> A promise that resolves to the API response. #### Throws If the Actions instance is not set for this comment or if the dislike command is not found. *** ### hasKey() > **hasKey**\<`T`, `R`\>(`key`): `this is CommentView & { [k in string]: R }` Defined in: [src/parser/helpers.ts:41](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/helpers.ts#L41) Check for a key without asserting the type. #### Type Parameters ##### T `T` *extends* `string` ##### R `R` = `any` #### Parameters ##### key `T` The key to check #### Returns `this is CommentView & { [k in string]: R }` Whether the node has the key #### Inherited from [`YTNode`](../../Helpers/classes/YTNode.md).[`hasKey`](../../Helpers/classes/YTNode.md#haskey) *** ### is() > **is**\<`T`, `K`\>(...`types`): `this is InstanceType` Defined in: [src/parser/helpers.ts:19](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/helpers.ts#L19) Check if the node is of the given type. #### Type Parameters ##### T `T` *extends* [`YTNode`](../../Helpers/classes/YTNode.md) ##### K `K` *extends* [`YTNodeConstructor`](../../Helpers/interfaces/YTNodeConstructor.md)\<`T`\>[] #### Parameters ##### types ...`K` The type to check #### Returns `this is InstanceType` whether the node is of the given type #### Inherited from [`YTNode`](../../Helpers/classes/YTNode.md).[`is`](../../Helpers/classes/YTNode.md#is) *** ### key() > **key**\<`T`, `R`\>(`key`): [`Maybe`](../../Helpers/classes/Maybe.md) Defined in: [src/parser/helpers.ts:51](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/helpers.ts#L51) Assert that the node has the given key and return it. #### Type Parameters ##### T `T` *extends* `string` ##### R `R` = `any` #### Parameters ##### key `T` The key to check #### Returns [`Maybe`](../../Helpers/classes/Maybe.md) The value of the key wrapped in a Maybe #### Throws If the node does not have the key #### Inherited from [`YTNode`](../../Helpers/classes/YTNode.md).[`key`](../../Helpers/classes/YTNode.md#key) *** ### like() > **like**(): `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> Defined in: [src/parser/classes/comments/CommentView.ts:149](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L149) Likes the comment. #### Returns `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> A promise that resolves to the API response. #### Throws If the Actions instance is not set for this comment or if the like command is not found. *** ### reply() > **reply**(`comment_text`): `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> Defined in: [src/parser/classes/comments/CommentView.ts:222](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L222) Replies to the comment. #### Parameters ##### comment\_text `string` The text of the reply. #### Returns `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> A promise that resolves to the API response. #### Throws If the Actions instance is not set for this comment or if the reply command is not found. *** ### setActions() > **setActions**(`actions`): `void` Defined in: [src/parser/classes/comments/CommentView.ts:273](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L273) #### Parameters ##### actions [`Actions`](../../../../classes/Actions.md) | `undefined` #### Returns `void` *** ### translate() > **translate**(`target_language`): `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md) & `object`\> Defined in: [src/parser/classes/comments/CommentView.ts:251](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L251) Translates the comment to the specified target language. #### Parameters ##### target\_language `string` The target language to translate the comment to, e.g. 'en', 'ja'. #### Returns `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md) & `object`\> Resolves to an ApiResponse object with the translated content, if available. #### Throws if the Actions instance is not set for this comment or if the comment content is not found. *** ### undislike() > **undislike**(): `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> Defined in: [src/parser/classes/comments/CommentView.ts:203](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L203) Undislikes the comment. #### Returns `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> A promise that resolves to the API response. #### Throws If the Actions instance is not set for this comment or if the undislike command is not found. *** ### unlike() > **unlike**(): `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> Defined in: [src/parser/classes/comments/CommentView.ts:185](https://github.com/LuanRT/YouTube.js/blob/faaf5fc5c15ff93eac8442b2fbdb4767d9a47b3f/src/parser/classes/comments/CommentView.ts#L185) Unlikes the comment. #### Returns `Promise`\<[`ApiResponse`](../../../../interfaces/ApiResponse.md)\> A promise that resolves to the API response. #### Throws If the Actions instance is not set for this comment or if the unlike command is not found.