@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
60 lines (59 loc) • 1.91 kB
TypeScript
import { Base } from './Base';
import type { ChatBot } from './ChatBot';
import type { ChannelEvents } from '../types';
import type { EventSubConnection } from '../enums';
import { Channel } from './Channel';
/**
* Represents a channel profile created when the chatbot joins to a channel.
*/
export declare class ChannelProfile<T extends EventSubConnection> extends Base<T> {
/**
* The Id of the channel.
*/
readonly id: string;
/**
* The events from the channel that the chatbot is subscribed to.
*/
readonly events: ChannelEvents[];
/**
* Creates a new instance of the channel profile.
* @param chatbot The current instance of the chatbot.
* @param data The data of the channel profile.
*/
constructor(chatbot: ChatBot<T>, data: ChannelProfileData);
addEvent(event: ChannelEvents): Promise<void>;
addEvent(event: ChannelEvents[]): Promise<void>;
/**
* Removes an event from the channel profile and stop listening to it. If the event is not added, it does nothing.
* @param event The event to remove.
* @returns
*/
removeEvent(event: ChannelEvents): Promise<void>;
/**
* Checks if one event is being listened.
* @param event The event to check.
* @returns
*/
hasEvent(event: ChannelEvents): boolean;
/**
* Fetches the current channel of the profile from the API.
* @returns The fetched channel from the API.
*/
fetch(): Promise<Channel<T>>;
/**
* Adds events in mass to the channel profile.
* @param events The events to add.
* @internal
* @returns
*/
private addMassEvents;
}
/**
* The data of the channel profile.
* @param id The Id of the channel.
* @param events The events from the channel that the chatbot is subscribed to.
*/
export interface ChannelProfileData {
id: string;
events: ChannelEvents[];
}