A Discord bot built with discord.js and TypeScript.
- Node.js (v16.9.0 or higher)
- npm (Node Package Manager)
- A Discord account
- A Discord server where you can test the bot
- TypeScript (optional, but recommended for development)
npm installcp .env.example .envDetailed setup instructions are in APP_INFO.md
Quick setup:
- Go to https://discord.com/developers/applications
- Create a new application (name cannot contain "discord")
- Go to "Bot" section and click "Add Bot"
- Click "Reset Token" to get your bot token
- Note: You may need to verify with 2FA (authenticator app or mobile link)
- Copy the token immediately (shows only once!)
- Paste the token in
.envasDISCORD_TOKEN - Enable MESSAGE CONTENT INTENT in Privileged Gateway Intents
- Click "Save Changes"
- Copy the Application ID from the General Information section
- Paste it in
.envasDISCORD_CLIENT_ID - (Optional) Get your server ID and add as
DISCORD_GUILD_IDfor faster development
- Go to OAuth2 > URL Generator
- Select scopes:
bot,applications.commands - Select permissions:
Send Messages,Use Slash Commands - Copy the generated URL and open it in your browser
- Select your server and authorize the bot
Run in development mode with auto-reload:
npm run devBuild for production:
npm run buildRun the built version:
npm start/ping- Test command that replies with "Pong!"
- Create a new file in
src/commands/(e.g.,mycommand.ts) - Export
data(SlashCommandBuilder) andexecutefunction - Add the command to
src/commands/index.ts