@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
80 lines (79 loc) • 2.46 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatRoomSettings = void 0;
const Base_1 = require("./Base");
/**
* Represents the settings of a chatroom.
*/
class ChatRoomSettings extends Base_1.Base {
/**
* The chatroom of the settings.
*/
chatroom;
/**
* The data representing the chat settings.
*/
data;
/**
* Creates a new instance of the chatroom settings.
* @param chatbot The current instance of the chatbot.
* @param chatroom The chatroom of the settings.
* @param data The data representing the chat settings.
*/
constructor(chatbot, chatroom, data) {
super(chatbot);
this.data = data;
this.chatroom = chatroom;
}
/**
* Edits the chat settings of the chatroom.
* @param options The options to edit the chat settings.
* @returns The updated chatroom settings.
*/
async edit(options) {
return new ChatRoomSettings(this.chatbot, this.chatroom, await this.chatbot.helixClient.updateChatSettings(this.chatroom.id, this.chatbot.userId, options));
}
/**
* The Id of the chatroom.
*/
get chatroomId() {
return this.chatroom.id;
}
/**
* Whether the chatroom is in emote only mode.
*/
get emotesOnly() {
return this.data.emote_mode;
}
/**
* The number of seconds a follower has to be following to be able to write. If the follower mode is disabled, this will return false.
*/
get followersOnly() {
return this.data.follower_mode ? this.data.follower_mode_duration * 60 : false;
}
/**
* Whether the chatroom is in subscriber mode.
*/
get subscriberMode() {
return this.data.subscriber_mode;
}
/**
* Whether the chatroom is in unique messages mode.
*/
get uniqueMessagesMode() {
return this.data.unique_chat_mode;
}
/**
* The slow mode duration of the chatroom in seconds. If slow mode is disabled, this will return false.
*/
get slowMode() {
return this.data.slow_mode ? this.data.slow_mode_wait_time : false;
}
/**
* The duration of the chat delay in seconds. If chat delay is disabled, this will return false.
*/
get chatDelay() {
return this.data.non_moderator_chat_delay ? this.data.non_moderator_chat_delay_duration : false;
}
}
exports.ChatRoomSettings = ChatRoomSettings;