@robojs/giveaways
One-click Discord giveaways with automatic winner selection and persistent storage.
Run giveaways in your Discord server with a single slash command. Members enter by clicking a button, and winners are selected automatically when time runs out. All data persists through restarts.
Features
Button Entry
Members enter and leave with a single click
Fair Selection
Fisher-Yates shuffle for unbiased randomization
Persistent Storage
All data lives in Flashcore, survives restarts
Role Restrictions
Allowlist or denylist roles per giveaway
Account Age Limits
Filter alt accounts by minimum age
Reroll Winners
Draw new winners from the remaining pool
Per-guild Settings
Each server customizes defaults and limits
REST API
HTTP endpoints for dashboard integrations
Quick start
Add the plugin to your Robo:
npx robo add @robojs/giveaways@nextOr start a new project with it pre-installed:
npx create-robo@next my-project -p @robojs/giveaways@nextStart a giveaway:
/giveaway start prize: Discord Nitro duration: 1h winners: 1The bot posts an embed with Enter Giveaway and Leave buttons. Members click to enter or withdraw. When the timer expires, the bot selects random winners, updates the message, announces results in the channel, and optionally DMs each winner.
How it works
Create a giveaway
A moderator runs /giveaway start with a prize, duration, and optional restrictions. The bot creates a record in Flashcore, posts an embed with entry buttons, and schedules automatic ending.
Members enter
Users click Enter Giveaway to join. The bot validates role restrictions and account age, records the entry, and replies with an ephemeral confirmation. Users can click Leave to withdraw at any time.
Winners are selected
When the timer expires (or a moderator runs /giveaway end), the bot selects random winners from all entries, updates the embed, posts a congratulations message, and sends DMs to winners if enabled.
Optional integrations
Enhanced scheduling with @robojs/cron
The plugin works without @robojs/cron, falling back to setTimeout for scheduling. Adding @robojs/cron provides persistent cron jobs with precise timing, which is recommended for production.
npx robo add @robojs/cron@nextNo code changes needed. The plugin detects @robojs/cron at runtime and uses it automatically.
| Capability | Without @robojs/cron | With @robojs/cron |
|---|---|---|
| Data persistence | Flashcore | Flashcore |
| Timing accuracy | setTimeout cascading | Precise cron expressions |
| Maximum duration | ~24.8 days per cycle | No practical limit |
| Job persistence | In-memory only | Stored in Flashcore |
| Recovery on restart | Re-schedules from saved data | Auto + validation |
REST API with @robojs/server
Install the server plugin to enable HTTP endpoints for dashboard integrations:
npx robo add @robojs/server@nextThis activates endpoints for listing giveaways, managing individual giveaways, and updating guild settings. See the API reference for details.
