Saves or updates giveaway data in storage.
If a giveaway with the same ID already exists, it should be updated. If it doesn't exist, a new record should be created.
The complete giveaway data to save
A Promise that resolves when the data has been saved
Retrieves a specific giveaway by its ID.
The unique giveaway ID to retrieve
A Promise that resolves to the giveaway data or null if not found
Retrieves all giveaways from storage.
This method is used during manager initialization to restore timeouts for active giveaways after a bot restart.
A Promise that resolves to an array of all giveaway data
Updates an existing giveaway with new data.
This method is used when editing giveaway details such as prize, winner count, or requirements.
The unique giveaway ID to update
The new giveaway data to save
A Promise that resolves when the update is complete
Base interface for giveaway storage adapters.
This interface defines the contract that all storage adapters must implement to provide persistent storage for giveaway data. Adapters can use any storage backend (JSON files, databases, cloud storage, etc.) as long as they implement these methods.
The interface supports full CRUD operations (Create, Read, Update, Delete) for giveaway data, allowing the GiveawayManager to work with different storage solutions without code changes.
Example