import type { Giveaway } from '../types/giveaway.js'; /** * Detect the optional `@robojs/cron` runtime and cache scheduling hooks. * * The detection promise is memoized so the function can be called multiple * times safely (the first invocation performs the dynamic import). When cron * is unavailable the plugin transparently falls back to `setTimeout` * scheduling. * * @returns Promise that resolves once cron availability has been determined. * @example * await initCron() */ export declare function initCron(): Promise; /** * Schedule the automatic completion of a giveaway at its configured end time. * * When `@robojs/cron` is available the giveaway is persisted as a cron * job that survives restarts; otherwise the function creates a cascading * `setTimeout` chain that reschedules for long-running giveaways. Expired * giveaways are processed immediately. * * @param giveaway - Giveaway instance that should be finalized at `endsAt`. * @returns Promise that resolves to the cron job ID string when cron is used, * or `null` when the setTimeout path is chosen. * @throws {Error} Propagates errors from the fallback scheduler if they occur; * cron-specific failures are logged and the function gracefully falls back to * `setTimeout` instead. * @example * const jobId = await scheduleGiveawayEnd(giveaway) * if (jobId) await Flashcore.set('job', jobId, { namespace: ['giveaways'] }) */ export declare function scheduleGiveawayEnd(giveaway: Giveaway): Promise; /** * Cancel a previously scheduled giveaway completion job. * * The function removes stored cron jobs (and associated mappings) when cron is * active, or performs best-effort cleanup in setTimeout mode. Calls are safe to * repeat even if the job has already been cleared. * * @param giveawayId - Giveaway identifier used for logging context. * @param cronJobId - Persisted cron job ID to remove, or `null`/`undefined` * when using the setTimeout fallback. * @returns Promise that resolves once cleanup attempts have finished. * @example * await cancelScheduledJob(giveaway.id, giveaway.cronJobId) */ export declare function cancelScheduledJob(giveawayId: string, cronJobId?: string | null): Promise;