GiveawayBot uses a modular command handler that discovers and registers slash commands automatically at startup. You never need to edit the core bot files — just drop a new TypeScript file intoDocumentation 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.
src/commands/, build, and restart.
How the handler works
src/handlers/Command.ts runs once when the bot starts. It uses readdirSync to scan the compiled build/commands/ directory for every .js file, imports each one, and registers it both with Discord’s API (via REST.put) and locally in client.slashCommands for routing.
src/commands/ is picked up on the next restart — no registration step needed.
The SlashCommand interface
Every command file must export a default object that satisfies theSlashCommand interface defined in src/types.d.ts:
command— a Discord.jsSlashCommandBuilder(or subclass) that defines the command name, description, and options.execute— called when a user runs the command.autocomplete— optional; called for autocomplete interactions on any of the command’s string options.modal— optional; called when a modal submit matches this command’s name viacustomId.cooldown— optional number of seconds. When set, theinteractionCreateevent handler automatically enforces the cooldown per user and sends a temporary reply if the user tries to run it too soon.
Adding a custom command
Create a new file in src/commands/
Create
src/commands/myCommand.ts. The filename becomes part of your workflow but does not affect the command name — that is set by SlashCommandBuilder.setName().Write the command
Implement the
SlashCommand interface. Here is a minimal, working example modeled on the existing command pattern:Cooldowns
Set the optionalcooldown property to a number of seconds to rate-limit a command per user:
interactionCreate event handler reads this value, tracks per-user timestamps in client.cooldowns, and replies with a countdown message if the user triggers the command too early. The cooldown reply is automatically deleted after 5 seconds.