Represents a livestream chat.
Before fetching a live chat, you have to retrieve the target livestream's info:
const info = await yt.getInfo('video_id');
Then you may request a live chat instance:
const livechat = await info.getLiveChat();
- LiveChat
- .ev ⇒
EventEmitter
- .start ⇒
function
- .stop ⇒
function
- .applyFilter ⇒
function
- .getItemMenu ⇒
function
- .sendMessage ⇒
function
- .ev ⇒
Live Chat's EventEmitter.
Events:
-
start
Fired when the live chat is started.
Arguments:
Type Description LiveChatContinuation
Initial chat data, actions, info, etc. -
chat-update
Fired when a new chat action is received.
Arguments:
Type Description ChatAction
Chat action -
metadata-update
Fired when the livestream's metadata is updated.
Arguments:
Type Description LiveMetadata
Livestream metadata -
error
Fired when an error occurs.
Arguments:
Type Description Error
Details about the error -
end
Fired when the livestream ends.
Starts the Live Chat.
Stops the Live Chat.
Applies given filter to the live chat.
Param | Type | Description |
---|---|---|
filter | string |
Can be TOP_CHAT or LIVE_CHAT |
Retrieves given chat item's menu.
Param | Type | Description |
---|---|---|
item | object |
Chat item |
Returns: Promise<ItemMenu>
Sends a message.
Param | Type | Description |
---|---|---|
text | string |
Message content |
Returns: Promise<ObservedArray<AddChatItemAction>>
See index.ts
.