@twitchfy/chatbot
Version:
A powerful node module to make your own Twitch ChatBot
80 lines (79 loc) • 1.94 kB
TypeScript
import { Base } from './Base';
import type { ChatBot } from './ChatBot';
import { BaseUser } from './BaseUser';
import type { EventSubConnection } from '../enums';
/**
* The base class for a message.
*/
export declare class BaseMessage<T extends EventSubConnection> extends Base<T> {
/**
* The id of the message.
*/
readonly id: string;
/**
* The content of the message.
*/
readonly content: string | null;
/**
* The author of the message.
*/
readonly author: BaseUser<T>;
/**
* The base data of the message.
*/
private data;
/**
* Creates a new instance of the base message.
* @param chatbot The current instance of the chatbot.
* @param data The base data of the message.
*/
constructor(chatbot: ChatBot<T>, data: BaseMessageData);
/**
* Deletes the message from the chatroom.
* @returns
*/
delete(): Promise<void>;
/**
* Replies to the message.
* @param message The message to reply with.
* @returns The message that was sent as a reply.
*/
reply(message: string): Promise<BaseMessage<T>>;
/**
* The Id of the chatroom where the message was sent.
*/
get chatroomId(): string;
/**
* Whether the message was sent by the chatbot.
*/
get self(): boolean;
}
/**
* The base data for a message.
*/
export interface BaseMessageData {
/**
* The id of the message.
*/
id: string;
/**
* The content of the message.
*/
content: string | null;
/**
* The id of the user who sent the message.
*/
user_id: string;
/**
* The display name of the user who sent the message.
*/
user_name: string;
/**
* The login name of the user who sent the message.
*/
user_login: string;
/**
* The id of the chatroom where the message was sent.
*/
chatroom_id: string;
}