@japofc/baileys - v2.4.7
    Preparing search index...

    Interface RentalManager

    interface RentalManager {
        size: number;
        add(
            chat: string,
            options?: {
                by?: string;
                days?: number;
                hours?: number;
                lifetime?: boolean;
                ms?: number;
            },
        ): { chat: string; expiresAt: number };
        extend(
            chat: string,
            duration: { by?: string; days?: number; hours?: number; ms?: number },
        ): { chat: string; expiresAt: number };
        filter<
            T extends
                (upsert: { messages: unknown[] }, ...rest: unknown[]) => unknown,
        >(
            handler: T,
        ): T;
        getExpiring(
            withinMs: number,
        ): { chat: string; expiresAt: number; remainingMs: number }[];
        getRental(chat: string): RentalInfo | null;
        isActive(chat: string): boolean;
        list(): { chat: string; expiresAt: number; trial: boolean }[];
        load(snapshot: Record<string, unknown>): void;
        onExpire(
            cb: (
                info: {
                    chat: string;
                    expiredAt: number;
                    since: number;
                    trial: boolean;
                },
            ) => void,
        ): () => void;
        onExpiring(
            cb: (
                info: { chat: string; expiresAt: number; remainingMs: number },
            ) => void,
        ): () => void;
        onGrant(
            cb: (
                info: { by?: string; chat: string; expiresAt: number; trial: boolean },
            ) => void,
        ): () => void;
        renderList(options?: { title?: string }): string;
        renderStatus(chat: string): string;
        revoke(chat: string): boolean;
        startSweeper(): () => void;
        startTrial(
            chat: string,
            options?: { days?: number },
        ): false | { chat: string; expiresAt: number };
        stats(): {
            active: number;
            expiringSoon: number;
            lifetime: number;
            paid: number;
            trial: number;
            trialsEverUsed: number;
        };
        stopSweeper(): void;
        sweep(): string[];
        toJSON(): Record<string, unknown>;
        transfer(
            fromChat: string,
            toChat: string,
            options?: { overwrite?: boolean },
        ): false | { expiresAt: number; from: string; to: string };
    }
    Index
    size: number
    • Grant/replace a rental; { lifetime: true } for forever.

      Parameters

      • chat: string
      • Optionaloptions: { by?: string; days?: number; hours?: number; lifetime?: boolean; ms?: number }

      Returns { chat: string; expiresAt: number }

    • Stack time (adds a rental when none exists). A paid top-up: clears the trial flag and, if by is given, records the payer.

      Parameters

      • chat: string
      • duration: { by?: string; days?: number; hours?: number; ms?: number }

      Returns { chat: string; expiresAt: number }

    • Wrap a messages.upsert handler — unrented groups are dropped.

      Type Parameters

      • T extends (upsert: { messages: unknown[] }, ...rest: unknown[]) => unknown

      Parameters

      • handler: T

      Returns T

    • Parameters

      • withinMs: number

      Returns { chat: string; expiresAt: number; remainingMs: number }[]

    • Returns { chat: string; expiresAt: number; trial: boolean }[]

    • Parameters

      • snapshot: Record<string, unknown>

      Returns void

    • Parameters

      • cb: (
            info: { chat: string; expiredAt: number; since: number; trial: boolean },
        ) => void

      Returns () => void

    • Fires once per rental as it crosses the expiring threshold.

      Parameters

      • cb: (info: { chat: string; expiresAt: number; remainingMs: number }) => void

      Returns () => void

    • Parameters

      • cb: (info: { by?: string; chat: string; expiresAt: number; trial: boolean }) => void

      Returns () => void

    • Owner overview of every active rental.

      Parameters

      • Optionaloptions: { title?: string }

      Returns string

    • '✅ Aktif — 12d 4h tersisa' style status line.

      Parameters

      • chat: string

      Returns string

    • One free trial per chat, ever. Returns false when already used.

      Parameters

      • chat: string
      • Optionaloptions: { days?: number }

      Returns false | { chat: string; expiresAt: number }

    • Owner dashboard counts across all rentals. paid is non-trial (incl. lifetime).

      Returns {
          active: number;
          expiringSoon: number;
          lifetime: number;
          paid: number;
          trial: number;
          trialsEverUsed: number;
      }

    • Fire expiries + renewal warnings now. Returns expired chats.

      Returns string[]

    • Migrate a rental to a new chat jid (e.g. a re-created group). Carries the "trial burned" marker across. Returns false if there is nothing to move or the destination already has a rental (unless overwrite: true).

      Parameters

      • fromChat: string
      • toChat: string
      • Optionaloptions: { overwrite?: boolean }

      Returns false | { expiresAt: number; from: string; to: string }