Class Chat

Class for handling incoming chat and outcoming chat

Hierarchy

  • Chat

Constructors

  • Chat class constructor

    Parameters

    • client: Client

      Open whatsaapp client instance

    • IncomingMessage: Message

      Open whatsapp .onMessage message instance

    • logger: Logger

      Pino logger instance

    • limitter: Limit

      p-limit instance for limitting message

    • contact: Contact

      Current chatter contact instance

    Returns Chat

Properties

args: string[]

Args list from user command

client: Client

Whatsapp client instance

contact: Contact

Current chatter contact instance

gameProperty?: {}

Accessible user game property by phone number

Type declaration

    incomingMessage: Message

    Actual incoming message object

    limitter: Limit

    Message limitter instance from p-limit

    logger: Logger

    Pino logger instance

    message: IMessage

    Accessible message instance that contains information about incoming message

    user?: {}

    Accessible user document by phone number

    Type declaration

      Accessors

      • get isDMChat(): boolean
      • Is current chatter sending message via DM chat

        Returns boolean

      • get isGroupChat(): boolean
      • Is current chatter sending message via Group chat

        Returns boolean

      • get isJoiningGame(): undefined | boolean
      • Is current chatter joinin a game session

        Returns undefined | boolean

      Methods

      • Get current contact profile picture string

        Returns Promise<string>

      • Current chatter have message media in it

        Returns Promise<{
            currentChat: Message;
            currentMedia: MessageMedia;
            hasMedia: true;
        } | {
            currentChat: undefined;
            currentMedia: undefined;
            hasMedia: false;
        }>

      • Current chatter have quoted message that have media in it

        Returns Promise<{
            hasQuotedMessage: true;
            quotedMessage: Message;
            quotedMessageMedia: MessageMedia;
        } | {
            hasQuotedMessage: false;
            quotedMessage: undefined;
            quotedMessageMedia: undefined;
        }>

      • Send reaction to current person chatter

        Parameters

        • emoji: string

          Emoji that will sended

        Returns Promise<void>

      • Reply current chatter using text or image with caption to current person chatter

        Parameters

        • content: MessageContent | MessageSendOptions

          The text that will sended

        • Optional image: MessageMedia

          Image that will sended in base64 data URL (Optional)

        Returns Promise<void>

      • Send text or image with caption to current person chatter

        Parameters

        • content: MessageContent | MessageSendOptions

          The text that will sended

        • Optional image: MessageMedia

          Image that will sended in base64 data URL (Optional)

        Returns Promise<void>

      • Send text or image with caption to someone

        Parameters

        • to: string
        • content: MessageContent | MessageSendOptions

          The text that will sended

        • Optional image: MessageMedia

          Image that will sended in base64 data URL (Optional)

        Returns Promise<void>

      • User property setter

        Parameters

        • user: {}

          An user document by phone number

          • gameProperty: {}

            Returns void

          Generated using TypeDoc