UNPKG

@twitchfy/chatbot

Version:

A powerful node module to make your own Twitch ChatBot

59 lines (58 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ban = void 0; const Base_1 = require("./Base"); /** * Represents a ban in a chatroom. */ class Ban extends Base_1.Base { /** * The Id of the user who was banned. */ userId; /** * The Id of the moderator who banned the user. */ moderatorId; /** * The data of the ban returned from the API. */ data; /** * Creates a new instance of the ban. * @param chatbot The current instance of the chatbot. * @param data The data of the ban returned from the API. */ constructor(chatbot, data) { super(chatbot); this.data = data; this.userId = data.user_id; this.moderatorId = data.moderator_id; } /** * Deletes the ban from the chatroom. * @returns */ async delete() { return await this.chatbot.helixClient.unBanUser(this.chatroomId, this.moderatorId, this.userId); } /** * The Id of the chatroom where the ban was made. */ get chatroomId() { return this.data.broadcaster_id; } /** * The Date when the ban was created. Returns a JavaScript Date object. */ get createdAt() { return new Date(this.data.created_at); } /** * If the ban is a timeout this will return the end time of the timeout in a JavaScript Date object. If not, it will return a nullish value. */ get endTime() { return this.data.end_time ? new Date(this.data.end_time) : null; } } exports.Ban = Ban;