@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
63 lines (62 loc) • 1.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelUpdate = void 0;
const BaseUser_1 = require("./BaseUser");
const Base_1 = require("./Base");
/**
* Represents a channel update event.
*/
class ChannelUpdate extends Base_1.Base {
/**
* The broadcaster of the channel who was updated.
*/
broadcaster;
/**
* The title of the channel.
*/
title;
/**
* The language of the channel.
*/
language;
/**
* The category of the channel.
*/
category;
/**
* The classification labels of the channel.
*/
classificationLabels;
/**
* The data of the update event returned from the EventSub.
*/
data;
/**
* Creates a new instance of the channel update event.
* @param chatbot The current instance of the chatbot.
* @param data The data of the update event returned from the EventSub.
*/
constructor(chatbot, data) {
super(chatbot);
this.data = data;
this.broadcaster = new BaseUser_1.BaseUser(chatbot, { ...data.broadcaster, display_name: data.broadcaster.displayName });
this.title = data.title;
this.language = data.language;
this.category = { id: data.category.id, name: data.category.name };
this.classificationLabels = data.labels;
}
/**
* The Id of the broadcaster who was updated.
*/
get broadcasterId() {
return this.data.broadcaster.id;
}
/**
* Fetches the channel from the API.
* @returns The fetched channel from the API.
*/
async channel() {
return this.chatbot.channels.fetch(this.broadcasterId);
}
}
exports.ChannelUpdate = ChannelUpdate;