youtubei.js / YT / LiveChat
Class: LiveChat
Defined in: src/parser/youtube/LiveChat.ts:58
Extends
Constructors
Constructor
new LiveChat(
video_info
):LiveChat
Defined in: src/parser/youtube/LiveChat.ts:73
Parameters
video_info
Returns
LiveChat
Overrides
Properties
initial_info?
optional
initial_info:LiveChatContinuation
Defined in: src/parser/youtube/LiveChat.ts:68
is_replay
is_replay:
boolean
=false
Defined in: src/parser/youtube/LiveChat.ts:71
metadata?
optional
metadata:LiveMetadata
Defined in: src/parser/youtube/LiveChat.ts:69
running
running:
boolean
=false
Defined in: src/parser/youtube/LiveChat.ts:70
smoothed_queue
smoothed_queue:
SmoothedQueue
Defined in: src/parser/youtube/LiveChat.ts:67
Methods
addEventListener()
addEventListener(
type
,callback
,options?
):void
Defined in: node_modules/typescript/lib/lib.dom.d.ts:8256
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
Parameters
type
string
callback
EventListenerOrEventListenerObject
| null
options?
boolean
| AddEventListenerOptions
Returns
void
Inherited from
applyFilter()
applyFilter(
filter
):void
Defined in: src/parser/youtube/LiveChat.ts:287
Applies given filter to the live chat.
Parameters
filter
Filter to apply.
"TOP_CHAT"
| "LIVE_CHAT"
Returns
void
dispatchEvent()
dispatchEvent(
event
):boolean
Defined in: node_modules/typescript/lib/lib.dom.d.ts:8262
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
Parameters
event
Event
Returns
boolean
Inherited from
emit()
emit(
type
, ...args
):void
Defined in: src/utils/EventEmitterLike.ts:10
Parameters
type
string
args
...any
[]
Returns
void
Inherited from
getItemMenu()
getItemMenu(
item
):Promise
<ItemMenu
>
Defined in: src/parser/youtube/LiveChat.ts:305
Retrieves given chat item's menu.
Parameters
item
ChatItemWithMenu
Returns
Promise
<ItemMenu
>
off()
off(
type
,listener
):void
Defined in: src/utils/EventEmitterLike.ts:40
Parameters
type
string
listener
(...args
) => void
Returns
void
Inherited from
on()
Call Signature
on(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:108
Parameters
type
"start"
listener
(initial_data
) => void
Returns
void
Overrides
Call Signature
on(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:109
Parameters
type
"chat-update"
listener
(action
) => void
Returns
void
Overrides
EventEmitter.on
Call Signature
on(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:110
Parameters
type
"metadata-update"
listener
(metadata
) => void
Returns
void
Overrides
EventEmitter.on
Call Signature
on(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:111
Parameters
type
"error"
listener
(err
) => void
Returns
void
Overrides
EventEmitter.on
Call Signature
on(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:112
Parameters
type
"end"
listener
() => void
Returns
void
Overrides
EventEmitter.on
once()
Call Signature
once(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:117
Parameters
type
"start"
listener
(initial_data
) => void
Returns
void
Overrides
Call Signature
once(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:118
Parameters
type
"chat-update"
listener
(action
) => void
Returns
void
Overrides
EventEmitter.once
Call Signature
once(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:119
Parameters
type
"metadata-update"
listener
(metadata
) => void
Returns
void
Overrides
EventEmitter.once
Call Signature
once(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:120
Parameters
type
"error"
listener
(err
) => void
Returns
void
Overrides
EventEmitter.once
Call Signature
once(
type
,listener
):void
Defined in: src/parser/youtube/LiveChat.ts:121
Parameters
type
"end"
listener
() => void
Returns
void
Overrides
EventEmitter.once
removeEventListener()
removeEventListener(
type
,callback
,options?
):void
Defined in: node_modules/typescript/lib/lib.dom.d.ts:8268
Removes the event listener in target's event listener list with the same type, callback, and options.
Parameters
type
string
callback
EventListenerOrEventListenerObject
| null
options?
boolean
| EventListenerOptions
Returns
void
Inherited from
EventEmitter
.removeEventListener
selectButton()
selectButton(
button
):Promise
<IParsedResponse
>
Defined in: src/parser/youtube/LiveChat.ts:320
Equivalent to "clicking" a button.
Parameters
button
Returns
Promise
<IParsedResponse
>
sendMessage()
sendMessage(
text
):Promise
<ObservedArray
<RunAttestationCommand
|AddChatItemAction
>>
Defined in: src/parser/youtube/LiveChat.ts:255
Sends a message.
Parameters
text
string
Text to send.
Returns
Promise
<ObservedArray
<RunAttestationCommand
| AddChatItemAction
>>
start()
start():
void
Defined in: src/parser/youtube/LiveChat.ts:126
Returns
void
stop()
stop():
void
Defined in: src/parser/youtube/LiveChat.ts:134
Returns
void