@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
40 lines (39 loc) • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatRoomSettingsManager = void 0;
const Base_1 = require("../Base");
const ChatRoomSettings_1 = require("../ChatRoomSettings");
/**
* Represents the manager for the settings of a chatroom.
*/
class ChatRoomSettingsManager extends Base_1.Base {
/**
* The settings' chatroom.
*/
chatroom;
/**
* Creates a new instance of the chatroom settings manager.
* @param chatbot The current instance of the chatbot.
* @param chatroom The settings' chatroom.
*/
constructor(chatbot, chatroom) {
super(chatbot);
this.chatroom = chatroom;
}
/**
* Edits the chatroom settings with the API.
* @param options The options to edit the chatroom settings.
* @returns The new settings of the chatroom.
*/
async edit(options) {
return new ChatRoomSettings_1.ChatRoomSettings(this.chatbot, this.chatroom, await this.chatbot.helixClient.updateChatSettings(this.chatroom.id, this.chatbot.userId, options));
}
/**
* Fetches the current settings of the chatroom from the API.
* @returns The current settings of the chatroom.
*/
async fetch() {
return new ChatRoomSettings_1.ChatRoomSettings(this.chatbot, this.chatroom, await this.chatbot.helixClient.getChatSettings(this.chatroom.id, this.chatbot.userId));
}
}
exports.ChatRoomSettingsManager = ChatRoomSettingsManager;