UNPKG

@twitchfy/chatbot

Version:

A powerful node module to make your own Twitch ChatBot

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