Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/resynceddesign/giveawaybot/llms.txt

Use this file to discover all available pages before exploring further.

Most GiveawayBot problems fall into a small number of categories: missing Discord Developer Portal settings, permission gaps in a channel, timing edge cases from bot downtime, or a malformed input. Work through the relevant accordion below to resolve the issue.
Cause: GiveawayBot requires privileged Gateway Intents (Guild Members and Message Content) that must be explicitly enabled in the Developer Portal before Discord will grant them.Fix:
  1. Go to the Discord Developer Portal and select your application.
  2. Open the Bot page from the left sidebar.
  3. Scroll down to Privileged Gateway Intents.
  4. Enable the two privileged intents: Server Members Intent and Message Content Intent. The standard Guilds and Guild Messages intents are non-privileged and do not require toggling.
  5. Save changes, then restart the bot.
Cause: Slash commands must be registered with Discord via the REST API. The Command.ts handler does this on startup, but only after a successful build.Fix:
  1. Run npm run build and confirm it completes without errors.
  2. Restart the bot (npm start). Watch the console for any errors during command registration.
  3. Wait for Discord to propagate the commands — global application commands can take up to one hour to appear in all servers.
If commands still don’t appear, verify that CLIENT_ID in your .env matches the Application ID for the correct Discord application.
Cause: The bot is responding to the interaction but lacks the channel permissions needed to send or embed its response.Fix: In the target channel’s settings, ensure the bot’s role has the following permissions:
  • Send Messages
  • Embed Links
  • Read Message History
You can verify channel-level overrides under Channel Settings → Permissions → (bot role or user).
Cause: The processGiveaways function (started in src/events/ready.ts) runs every 1000 ms and compares createdAt + duration * 1000 against the current time. If the bot is offline when a giveaway is scheduled to end, the comparison never runs and the giveaway remains open.Fix: Keep the bot running continuously using a process manager such as PM2 or a systemd service. When the bot restarts after downtime, processGiveaways will execute immediately on the first tick and end any overdue giveaways right away.
Cause: The duration argument is parsed by parseDuration in src/functions.ts using the regex /^(\d+)([smhd])$/. Any string that doesn’t match — including those with spaces, decimal points, or unsupported units — will fail validation.Fix: Use one of the four supported formats with no spaces or extra characters:
FormatMeaning
30s30 seconds
5m5 minutes
2h2 hours
1d1 day
Multi-unit durations (e.g., 1h30m) are not supported. Use the next-closest single unit instead.
Cause: better-sqlite3 attempts to open (or create) src/database/data/database.db at startup. If the src/database/data/ directory does not exist, the open call throws an error and the bot exits.Fix: Create the directory manually, then restart the bot:
mkdir -p src/database/data
npm start
The database.db file will be created automatically on the first run.
Cause: The winner has DMs from server members disabled in their Discord privacy settings, or they have blocked the bot.This is expected behavior and is handled gracefully in the codebase — the DM error is caught and ignored. The winner is still announced publicly in the giveaway channel, so no action from the host is required. Winners can contact the host directly to claim their prize.
Cause: Regenerating a bot token in the Developer Portal immediately invalidates the previous token. Any running bot process using the old token will disconnect and be unable to reconnect.Fix:
  1. Go to Developer Portal → BotReset Token and copy the new token.
  2. Update the TOKEN value in your .env file.
  3. Restart the bot with npm start.
If your issue isn’t listed here, please open an issue on the GiveawayBot GitHub repository. Include the error message from your console, your Node.js version (node -v), and the steps to reproduce the problem.

Build docs developers (and LLMs) love