@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
58 lines (57 loc) • 1.59 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.User = void 0;
const BaseUser_1 = require("./BaseUser");
/**
* Represents a Twitch user.
*/
class User extends BaseUser_1.BaseUser {
/**
* The description of the user.
*/
description;
/**
* The profile image URL of the user.
*/
profileImage;
/**
* The data of the user returned from the API.
*/
data;
/**
* Creates a new instance of the user.
* @param chatbot The current instance of the chatbot.
* @param data The data of the user returned from the API.
*/
constructor(chatbot, data) {
super(chatbot, data);
this.data = data;
this.description = data.description;
this.profileImage = data.profile_image_url;
}
/**
* When the user was created. A JavaScript Date object is returned.
*/
get createdAt() {
return new Date(this.data.created_at);
}
/**
* The user's type.
*/
get userType() {
return this.data.type.length ? this.data.type : 'normal';
}
/**
* The user's broadcaster type. Possible values are 'partner', 'affiliate' and 'normal'.
*/
get broadcasterType() {
return this.data.broadcaster_type.length ? this.data.broadcaster_type : 'normal';
}
/**
* The user's offline image url. Returns null if the user has no offline image set
*/
get offlineImage() {
return this.data.offline_image_url.length ? this.data.offline_image_url : null;
}
}
exports.User = User;