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

    Interface QuizSession

    interface QuizSession {
        size: number;
        answer(
            chat: string,
            user: string,
            text: string,
        ): "wrong" | "correct" | null;
        bind(sock: unknown): () => void;
        end(
            chat: string,
        ):
            | {
                chat: string;
                questionsAsked: number;
                ranking: { score: number; user: string }[];
                reason: string;
                total: number;
                winner: { score: number; user: string } | null;
            }
            | null;
        getScores(chat: string): { score: number; user: string }[] | null;
        handler(upsert: { messages: unknown[] }): void;
        isActive(chat: string): boolean;
        onCorrect(
            cb: (
                info: {
                    answer: string | number;
                    chat: string;
                    index: number;
                    points: number;
                    scores: { score: number; user: string }[];
                    user: string;
                },
            ) => void,
        ): () => void;
        onEnd(cb: (result: Record<string, unknown>) => void): () => void;
        onQuestion(
            cb: (
                info: {
                    chat: string;
                    deadline: number;
                    index: number;
                    points: number;
                    question: string;
                    total: number;
                },
            ) => void,
        ): () => void;
        onTimeout(
            cb: (
                info: {
                    answer: string | number;
                    chat: string;
                    index: number;
                    question: string;
                    skipped?: boolean;
                },
            ) => void,
        ): () => void;
        skip(chat: string): boolean;
        start(
            chat: string,
            questions: QuizQuestion[],
            options?: { random?: () => number; shuffle?: boolean },
        ): { chat: string; total: number };
        unbind(): void;
    }
    Index
    size: number
    • Parameters

      • chat: string
      • user: string
      • text: string

      Returns "wrong" | "correct" | null

    • Parameters

      • sock: unknown

      Returns () => void

    • End early. Returns the final ranking.

      Parameters

      • chat: string

      Returns
          | {
              chat: string;
              questionsAsked: number;
              ranking: { score: number; user: string }[];
              reason: string;
              total: number;
              winner: { score: number; user: string } | null;
          }
          | null

    • Parameters

      • chat: string

      Returns { score: number; user: string }[] | null

    • Parameters

      • upsert: { messages: unknown[] }

      Returns void

    • Parameters

      • cb: (
            info: {
                answer: string | number;
                chat: string;
                index: number;
                points: number;
                scores: { score: number; user: string }[];
                user: string;
            },
        ) => void

      Returns () => void

    • Parameters

      • cb: (result: Record<string, unknown>) => void

      Returns () => void

    • Parameters

      • cb: (
            info: {
                chat: string;
                deadline: number;
                index: number;
                points: number;
                question: string;
                total: number;
            },
        ) => void

      Returns () => void

    • Per-question timeouts AND host skips (skipped: true).

      Parameters

      • cb: (
            info: {
                answer: string | number;
                chat: string;
                index: number;
                question: string;
                skipped?: boolean;
            },
        ) => void

      Returns () => void

    • Skip the current question (reveals the answer via onTimeout).

      Parameters

      • chat: string

      Returns boolean

    • Parameters

      • chat: string
      • questions: QuizQuestion[]
      • Optionaloptions: { random?: () => number; shuffle?: boolean }

      Returns { chat: string; total: number }