UNPKG

@twitchfy/chatbot

Version:

A powerful node module to make your own Twitch ChatBot

120 lines (119 loc) 3.69 kB
import type { MessageTypes } from '@twitchfy/eventsub'; import type { ChatBot } from './ChatBot'; import { BaseMessage } from './BaseMessage'; import { BaseUser } from './BaseUser'; import { MessageReply } from './MessageReply'; import { Collection } from './Collection'; import { BaseEmote } from './BaseEmote'; import type { ChatRoom } from './ChatRoom'; import { BaseCheermote } from './BaseCheermote'; import type { EventSubConnection } from '../enums'; import type { MessageData } from '../types'; /** * Represents a message in a chatroom. */ export declare class Message<T extends EventSubConnection> extends BaseMessage<T> { /** * The content of the message. */ readonly content: string; /** * The type of the message. */ readonly type: MessageTypes; /** * The chatroom where the message was sent. */ readonly chatroom: ChatRoom<T>; /** * The mentions in the message. */ readonly mentions: Collection<string, BaseUser<T>>; /** * The emotes in the message. */ readonly emotes: Collection<string, BaseEmote<T>>; /** * The cheermotes in the message. */ readonly cheermotes: Collection<string, BaseCheermote<T>>; /** * The bits cheered in the message. */ readonly bits: number; /** * The reward Id of the message. Null if the message doesn't have a reward redemption. */ readonly rewardId: string | null; /** * The message reply of the message. Null if the message doesn't have a reply. */ readonly messageReply: MessageReply<T> | null; /** * The data of the message. */ private commandData; /** * Creates a new instance of the message. * @param chatbot The current instance of the chatbot. * @param data The data of the message. * @param chatroom The chatroom where the message was sent. */ constructor(chatbot: ChatBot<T>, data: MessageData<T>, chatroom: ChatRoom<T>); /** * The Id of the author of the message. */ get authorId(): string; /** * Whether the message is a normal text message. */ get isText(): boolean; /** * Whether the message was highlighted by the highlight message reward. */ get isHighlighted(): boolean; /** * Whether the message was sent by the send in subscriber mode reward. */ get isChannelPointsSubOnly(): boolean; /** * Whether the message is an user intro message. */ get isUserIntro(): boolean; /** * The message which was replied by this message. Null if the message doesn't have a reply. */ get parentReply(): import("structures").MessageReplyParent<T> | null; /** * The start message of the thread where this message is part of. Null if the message is not part of a thread. */ get threadReply(): import("structures").MessageReplyThread<T> | null; /** * Whether the message has a reward reedemption. */ get hasRewardRedeemption(): boolean; /** * Parse the content of the message if the message is a command to remove the prefix and the command name. * @returns The parsed content. * @internal */ private __parseContent; /** * Parse the mentions of the message. * @returns A collection of the mentions. * @internal */ private __parseMentions; /** * Parse the emotes of the message. * @returns A collection of the emotes. * @internal */ private __parseEmotes; /** * Parse the cheermotes of the message. * @returns A collection of the cheermotes. * @internal */ private __parseCheermotes; }