UNPKG

@twitchfy/chatbot

Version:

A powerful node module to make your own Twitch ChatBot

37 lines (36 loc) 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChatBotTimeoutManager = void 0; const Base_1 = require("../Base"); const Ban_1 = require("../Ban"); /** * The timeout manager of the chatbot. */ class ChatBotTimeoutManager extends Base_1.Base { /** * Creates a new instance of the timeout manager. * @param chatbot The current instance of the chatbot. */ constructor(chatbot) { super(chatbot); } /** * Timeout a specific user. * @param chatroomId The id of the chatroom where the user will be sent into a timeout. * @param options The options required for send an user into a timeout. See {@link Timeout}. * @returns A class representation of the timeout. See {@link Ban}. */ async add(chatroomId, options) { new Ban_1.Ban(this.chatbot, await this.chatbot.helixClient.banUser(chatroomId, this.chatbot.userId, { data: { user_id: options.userId, ...options } })); } /** * Deletes the timeout of a specific user. * @param chatroomId The id of the chatroom where the user will be removed from the timeout. * @param userId The id of the user to remove from the timeout. * @returns */ async delete(chatroomId, userId) { return await this.chatbot.helixClient.unBanUser(chatroomId, this.chatbot.userId, userId); } } exports.ChatBotTimeoutManager = ChatBotTimeoutManager;