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

    Interface MarriageRegistry

    Marriage registry — propose/accept/divorce, strictly monogamous.

    interface MarriageRegistry {
        size: number;
        accept(
            user: string,
            from: string,
        ):
            | { marriedAt: number; ok: true }
            | { ok: false; reason: "no-proposal" | "someone-married-meanwhile" };
        divorce(
            user: string,
        ):
            | { lastedDays: number; ok: true; partner: string }
            | { ok: false; reason: "not-married" };
        getMarriage(
            user: string,
        ): { days: number; marriedAt: number; partner: string } | null;
        getPartner(user: string): string | null;
        isMarried(user: string): boolean;
        listCouples(): { a: string; b: string; days: number; marriedAt: number }[];
        load(snapshot: Record<string, unknown>): void;
        onDivorced(
            cb: (info: { a: string; b: string; lastedDays: number }) => void,
        ): () => void;
        onMarried(
            cb: (info: { a: string; b: string; marriedAt: number }) => void,
        ): () => void;
        propose(
            from: string,
            to: string,
        ):
            | { expiresAt: number; ok: true }
            | {
                ok: false;
                reason:
                    | "self"
                    | "you-are-married"
                    | "target-married"
                    | "already-proposed";
            };
        reject(user: string, from: string): boolean;
        renderCouples(options?: { title?: string }): string;
        toJSON(): Record<string, unknown>;
    }
    Index
    size: number

    Number of couples.

    • Accept a proposal FROM from.

      Parameters

      • user: string
      • from: string

      Returns
          | { marriedAt: number; ok: true }
          | { ok: false; reason: "no-proposal" | "someone-married-meanwhile" }

    • Parameters

      • user: string

      Returns
          | { lastedDays: number; ok: true; partner: string }
          | { ok: false; reason: "not-married" }

    • Parameters

      • user: string

      Returns { days: number; marriedAt: number; partner: string } | null

    • Every couple once, longest first.

      Returns { a: string; b: string; days: number; marriedAt: number }[]

    • Parameters

      • snapshot: Record<string, unknown>

      Returns void

    • Parameters

      • cb: (info: { a: string; b: string; lastedDays: number }) => void

      Returns () => void

    • Parameters

      • cb: (info: { a: string; b: string; marriedAt: number }) => void

      Returns () => void

    • Parameters

      • from: string
      • to: string

      Returns
          | { expiresAt: number; ok: true }
          | {
              ok: false;
              reason: "self" | "you-are-married" | "target-married" | "already-proposed";
          }

    • Parameters

      • user: string
      • from: string

      Returns boolean

    • Parameters

      • Optionaloptions: { title?: string }

      Returns string