@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
130 lines (129 loc) • 4.78 kB
TypeScript
import type { AnnouncementOptions } from '@twitchfy/helix';
import { Base } from './Base';
import type { ChatBot } from './ChatBot';
import { BaseUser } from './BaseUser';
import { AutoMod } from './AutoMod';
import { BaseChannel } from './BaseChannel';
import { ChatterManager } from './managers';
import { MessageManager, BanManager, TimeoutManager, ChatRoomSettingsManager, WarnsManager } from './managers';
import type { EventSubConnection } from '../enums';
/**
* Represents a Twitch chatroom of a channel.
*/
export declare class ChatRoom<T extends EventSubConnection> extends Base<T> {
/**
* The broadcaster who owns the chatroom.
*/
readonly broadcaster: BaseUser<T>;
/**
* The channel of the chatroom.
*/
readonly channel: BaseChannel<T>;
/**
* The ban manager of the chatroom.
*/
readonly bans: BanManager<T>;
/**
* The timeout manager of the chatroom.
*/
readonly timeouts: TimeoutManager<T>;
/**
* The settings manager of the chatroom.
*/
readonly settings: ChatRoomSettingsManager<T>;
/**
* The warns manager of the chatroom.
*/
readonly warns: WarnsManager<T>;
/**
* The chatters manager of the chatroom.
*/
readonly chatters: ChatterManager<T>;
/**
* The automod manager of the chatroom.
*/
readonly automod: AutoMod<T>;
/**
* The message manager of the chatroom.
*/
readonly messages: MessageManager<T>;
/**
* The data of the chatroom.
*/
private data;
/**
* Creates a new instance of the chatroom.
* @param chatbot The current instance of the chatbot.
* @param data The data of the chatroom.
*/
constructor(chatbot: ChatBot<T>, data: ChatRoomData);
/**
* The Id of the chatroom. Its id is the same as the broadcaster id.
*/
get id(): string;
/**
* Sends a message to the chatroom.
* @param message The message to send.
* @returns The message that was sent. See {@link BaseMessage}
*/
send(message: string): Promise<import("structures").BaseMessage<T>>;
/**
* Sets the slow mode of the chatroom.
* @param duration The duration of the slow mode in seconds. If null, it will disable the slow mode.
* @returns The updated settings of the chatroom.
*/
setSlowMode(duration: number | null): Promise<import("structures").ChatRoomSettings<T>>;
/**
* Sets the followers mode of the chatroom.
* @param duration The time, in seconds, the followers must be following the broadcaster to be able to send a message. If null, it will disable the followers mode.
* @returns The updated settings of the chatroom.
*/
setFollowersMode(duration: number | null): Promise<import("structures").ChatRoomSettings<T>>;
/**
* Sets the subscribers mode of the chatroom.
* @param enabled Whether the subscribers mode is enabled.
* @returns The updated settings of the chatroom.
*/
setSubscribersMode(enabled: boolean): Promise<import("structures").ChatRoomSettings<T>>;
/**
* Sets the unique messages mode of the chatroom.
* @param enabled Whether the unique messages mode is enabled.
* @returns The updated settings of the chatroom.
*/
setUniqueMessagesMode(enabled: boolean): Promise<import("structures").ChatRoomSettings<T>>;
/**
* Sets the chat delay of the chatroom.
* @param duration The duration of the chat delay in seconds. If null, it will disable the chat delay.
* @returns The updated settings of the chatroom.
*/
setChatDelay(duration: 2 | 4 | 6 | null): Promise<import("structures").ChatRoomSettings<T>>;
/**
* Sets the emote only mode of the chatroom.
* @param enabled Whether the emote only mode is enabled.
* @returns The updated settings of the chatroom.
*/
setEmoteOnlyMode(enabled: boolean): Promise<import("structures").ChatRoomSettings<T>>;
/**
* Sends an announcement to the chatroom.
* @param options The options of the announcement. See {@link AnnouncementOptions}
* @returns The announcement that was sent.
*/
announce(options: AnnouncementOptions): Promise<void>;
/**
* Sends a shoutout to a user in the chatroom.
* @param receiverId The Id of the user to shoutout.
* @returns The shoutout that was sent.
*/
shoutout(receiverId: string): Promise<void>;
}
/**
* The data of the chatroom.
* @param broadcaster_id The Id of the broadcaster.
* @param broadcaster_name The name of the broadcaster.
* @param broadcaster_login The login of the broadcaster.
*/
export interface ChatRoomData {
broadcaster_id: string;
broadcaster_name: string;
broadcaster_login: string;
}