@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
35 lines (34 loc) • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatBotChatterManager = void 0;
const Base_1 = require("../Base");
const BaseUser_1 = require("../BaseUser");
/**
* Represents a chatter manager.
*/
class ChatBotChatterManager extends Base_1.Base {
/**
* Creates a new instance of the chatter manager.
* @param chatbot The current instance of the chatbot.
*/
constructor(chatbot) {
super(chatbot);
}
/**
* Fetches the chatters of a chatroom.
* @param chatroomId The id of the chatroom to fetch the chatters.
* @returns The chatters of the chatroom.
*/
async fetch(chatroomId) {
return (await this.chatbot.helixClient.getChatters(chatroomId, this.chatbot.userId)).map((x) => new BaseUser_1.BaseUser(this.chatbot, { id: x.user_id, login: x.user_login, display_name: x.user_name }));
}
/**
* Gets the amount of chatters in a chatroom.
* @param chatroomId The id of the chatroom to count the chatters.
* @returns The amount of chatters in the chatroom.
*/
async count(chatroomId) {
return await this.chatbot.helixClient.getChattersCount(chatroomId, this.chatbot.userId);
}
}
exports.ChatBotChatterManager = ChatBotChatterManager;