import { Room } from '../../../skychat/Room.js'; import { Session } from '../../../skychat/Session.js'; export type PollState = 'pending' | 'started' | 'finished'; export type PollOptions = { /** * Poll audience. Can be a room object, a list of sessions or addressed to everyone */ audience: Room | Session[] | '*'; /** * Default value */ defaultValue: boolean | undefined; /** * Timeout in milliseconds */ timeout: number; /** * Minimum required number of votes */ minVotes?: number; }; export type SanitizedPoll = { id: number; state: PollState; title: string; content: string; result: undefined | boolean; yesCount: number; noCount: number; opVote: undefined | boolean; }; export declare class Poll { private static CURRENT_POLL_ID; readonly id: number; state: PollState; readonly title: string; readonly content: string; readonly options: PollOptions; opVote?: boolean; votes: { [identifier: string]: boolean; }; constructor(title: string, content: string, options: PollOptions); /** * Register a vote * @param identifier * @param vote */ registerVote(identifier: string, vote: boolean): false | undefined; /** * Force the result of this poll * @param vote */ forceResult(vote: boolean): void; /** * Get the result of the poll. Boolean if a response is chosen, undefined if not enough voters */ getResult(): boolean | undefined; /** * Await for this poll to complete */ complete(): Promise; sanitized(): SanitizedPoll; sync(): void; }