Skip to content

Clip

Represents a Twitch clip.

Extends

Type parameters

Type parameter
T extends EventSubConnection

Constructors

new Clip()

1
new Clip<T>(chatbot: ChatBot<T>, data: GetClip): Clip<T>

Creates a new instance of the clip.

Parameters

ParameterTypeDescription
chatbotChatBot<T>The current instance of the chatbot.
dataGetClipThe data of the clip returned from the API.

Returns

Clip<T>

Overrides

BaseClip.constructor

Source

twitchfy/packages/chatbot/src/structures/Clip.ts:78

Properties

PropertyModifierTypeDescriptionInherited from
broadcasterreadonlyBaseUserWithoutUsername<T>The user who broadcasted the clip. The user will not have an username because Twitch limitations.-
chatbotreadonlyChatBot<T>The current instance of the chatbot.BaseClip.chatbot
creatorreadonlyBaseUserWithoutUsername<T>The user who created the clip. The user will not have an username because Twitch limitations.-
durationreadonlynumberThe duration of the clip in seconds.-
embedURLreadonlystringThe URL to embed the clip in a frame.-
gameIdreadonlystringThe Id of the game which was played in the clip.-
idreadonlystringThe id of the clip.BaseClip.id
isFeaturedreadonlybooleanWhether the clip is featured.-
languagereadonlystringThe language of the clip.-
thumbnailURLreadonlystringThe URL to the thumbnail of the clip.-
titlereadonlystringThe title of the clip.-
urlreadonlystringThe url of the clip.BaseClip.url
viewCountreadonlynumberThe view count of the clip.-
vodOffsetreadonlynull | numberThe offset in the VOD where the clip starts. If the clip is not from a VOD, this will be null.-

Accessors

createdAt

1
get createdAt(): Date

When the clip was created. Returns a JavaScript Date object.

Returns

Date

Source

twitchfy/packages/chatbot/src/structures/Clip.ts:97


videoId

1
get videoId(): null | string

The Id of the video of the clip.

Returns

null | string

Source

twitchfy/packages/chatbot/src/structures/Clip.ts:104

Methods

download()

1
download(): Promise<object>

Downloads the clip’s video data. For this to work, the bot has to be an editor of the clip’s channel and the user token must have the editor:manage:clips scope or channel:manage:clips if the bot is the broadcaster of the channel.

Returns

Promise<object>

An object of buffers containing the clip’s video data in either portrait or landscape format. The field is null if the download URL doesn’t exist or the fetch fails.

MemberType
landscapenull | Buffer
portraitnull | Buffer

Source

twitchfy/packages/chatbot/src/structures/Clip.ts:142


fetch()

1
fetch(): Promise<null | Clip<T>>

Fetches the information of the clip from the API.

Returns

Promise<null | Clip<T>>

The fetched clip. Returns null if the clip was not found (probably because it was not cached yet).

Inherited from

BaseClip.fetch

Source

twitchfy/packages/chatbot/src/structures/BaseClip.ts:47


getDownloadURL()

1
getDownloadURL(): Promise<object>

Fetches the download URLs of the clip. Either landscape or portrait. For this to work, the bot has to be an editor of the clip’s channel and the user token must have the editor:manage:clips scope or channel:manage:clips if the bot is the broadcaster of the channel.

Returns

Promise<object>

An object with each download URL. The field is null if the download URL doesn’t exist.

MemberType
landscapenull | string
portraitnull | string

Source

twitchfy/packages/chatbot/src/structures/Clip.ts:130


stream()

1
stream(): Promise<null | Stream<T>>

Fetches the stream of the broadcaster of the clip.

Returns

Promise<null | Stream<T>>

The stream of the broadcaster of the clip. If the stream is offline, it will return null.

Source

twitchfy/packages/chatbot/src/structures/Clip.ts:121


toString()

1
toString(): string

Returns

string

The url of the clip.

Inherited from

BaseClip.toString

Source

twitchfy/packages/chatbot/src/structures/BaseClip.ts:39


video()

1
video(): Promise<null | Video<T>>

Fetches the video of the clip.

Returns

Promise<null | Video<T>>

The video of the clip. Returns null if the video doesn’t exist.

Source

twitchfy/packages/chatbot/src/structures/Clip.ts:112