@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
63 lines (62 loc) • 1.67 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stream = void 0;
const BaseStream_1 = require("./BaseStream");
/**
* Represents a Twitch stream.
*/
// @ts-expect-error
class Stream extends BaseStream_1.BaseStream {
/**
* The amount of viewers watching the stream.
*/
viewerCount;
/**
* The language of the stream.
*/
language;
/**
* The tags of the stream.
*/
tags;
/**
* Whether the stream is marked as mature.
*/
isMature;
/**
* The game which is currently being played on the stream.
*/
game;
/**
* The data of the stream returned from the API.
*/
data;
/**
* Creates a new instance of the stream.
* @param chatbot The current instance of the chatbot.
* @param data The data of the stream returned from the API.
*/
constructor(chatbot, data) {
super(chatbot, data);
this.data = data;
this.viewerCount = data.viewer_count;
this.language = data.language;
this.tags = data.tags;
this.isMature = data.is_mature;
this.game = { id: data.game_id, name: data.game_name };
}
/**
* The title of the stream.
*/
get title() {
return this.data.title.length ? this.data.title : null;
}
/**
* The thumbnail URL of the stream.
* @param options The options for the thumbnail.
*/
thumbnailURL(options) {
return this.data.thumbnail_url.replace('{width}', options?.width?.toString() || '1920').replace('{height}', options?.height?.toString() || '1080');
}
}
exports.Stream = Stream;