A fun Indonesian Truth or Dare Discord bot with spin-the-bottle mechanics. Players are randomly selected and must choose between answering a truth question or completing a dare challenge.
- 🎯 Random Player Selection - Spin the bottle to pick a random player
- 🤔 Truth Questions - Indonesian truth questions stored in Neon PostgreSQL
- 🔥 Dare Challenges - Indonesian dare challenges stored in database
- 🎲 Random Mode - Let fate decide between truth or dare
- ⏭️ Skip Function - Other players can skip if someone is AFK
- 🔒 Turn Protection - Only the selected player can answer
- 🎨 Rich Embeds - Beautiful Discord embeds with colors and emojis
- 💾 Database Storage - Questions stored in Neon PostgreSQL
- 🌐 Web Interface - Add new questions via key-protected web page
- 🚀 Production Ready - Deployed on Fly.io with health monitoring
- ⚡ All-in-One - Bot and web interface run on the same port
- 🎮 Interactive Commands - Fun mini-games and utilities
| Command | Description |
|---|---|
/tod |
Start a new Truth or Dare game |
| Command | Description |
|---|---|
/health |
Check bot status and uptime |
/stats |
View question statistics |
/addquestion |
Get info on how to add questions |
| Command | Description |
|---|---|
/ping |
Check bot latency |
/hello |
Get a friendly greeting |
/help |
Show all commands and how to play |
- Type
/todto start the game - Bot randomly selects a player (spin the bottle)
- Selected player chooses:
- Truth 🤔 - Answer a personal question
- Dare 🔥 - Complete a challenge
- Random 🎲 - Let the bot decide
- After completing, click "Putar Lagi!" to select next player
- Other players can click "Skip" if someone is AFK
druth-or-tare/
├── src/
│ ├── bot.js # Main bot + web server (all-in-one)
│ ├── commands/ # Command handlers
│ │ ├── ping.js
│ │ ├── hello.js
│ │ ├── help.js
│ │ ├── tod.js # Truth or Dare game logic
│ │ ├── health.js # Bot status
│ │ ├── stats.js # Question statistics
│ │ ├── addquestion.js # Add question info
│ ├── config/ # Configuration files
│ │ ├── bot.js # Bot settings & colors
│ │ └── commands.js # Command definitions
│ ├── database/ # Database layer
│ │ ├── connection.js # Neon PostgreSQL connection
│ │ ├── questions.js # Question queries
│ │ └── init.js # Database initialization
│ └── utils/ # Utility functions
│ ├── game.js # Game logic helpers
│ └── uptime.js # Uptime formatter
├── data/ # Static data
│ └── questions.js # Initial questions for seeding
├── index.js # Application entry point
├── register.js # Register slash commands
├── init-db.js # Initialize database
├── Dockerfile # Docker configuration
├── fly.toml # Fly.io deployment config
└── package.json
- Runtime: Bun v1.3.2
- Library: Discord.js v14
- Database: Neon PostgreSQL (Serverless)
- Deployment: Fly.io
- Language: JavaScript (ES Modules)
- Bun installed
- Discord Bot Token (Get one here)
- Neon Database (Create one here)
- Fly.io account (for deployment)
- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Go to "Bot" tab:
- Click "Reset Token" and copy your
TOKEN - Enable these intents:
- ✅ Presence Intent
- ✅ Server Members Intent
- ✅ Message Content Intent
- Click "Reset Token" and copy your
- Go to "OAuth2" tab:
- Copy your
CLIENT_ID(Application ID)
- Copy your
- Get your
GUILD_ID:- Enable Developer Mode in Discord (Settings → Advanced → Developer Mode)
- Right-click your server → Copy Server ID
- Clone the repository:
git clone https://github.com/handikatriarlan/druth-or-tare
cd druth-or-tare- Install dependencies:
bun install- Create
.envfile:
TOKEN=your_discord_bot_token
CLIENT_ID=your_application_id
GUILD_ID=your_server_id
DATABASE_URL=your_neon_database_url
ADMIN_KEY=your_secure_key
PORT=3000- Initialize database:
bun run init-db- Register slash commands:
bun run register- Run the bot:
bun run start-
Access web interface:
- Open
http://localhost:3000/adminin your browser - Bot and web run on the same port!
- Open
-
Invite bot to your server:
https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=274878024768&scope=bot%20applications.commands
Replace YOUR_CLIENT_ID with your actual Client ID.
The bot includes a built-in web interface accessible at the same URL:
- Health Check:
http://localhost:3000/ - Admin Panel:
http://localhost:3000/admin
- Go to
/adminendpoint - Enter admin key (from
.env) - Select question type (Truth or Dare)
- Enter the question
- Submit - questions are immediately available (no restart needed!)
| Script | Description |
|---|---|
bun run start |
Start the bot (includes web interface) |
bun run dev |
Start with auto-reload |
bun run register |
Register Discord commands |
bun run init-db |
Initialize database |
bun run deploy |
Deploy to Fly.io |
bun run logs |
View Fly.io logs |
# Start bot
docker-compose up -d
# View logs
docker-compose logs -f
# Stop bot
docker-compose down
# Rebuild after changes
docker-compose up -d --build- Install Fly CLI:
curl -L https://fly.io/install.sh | sh- Login:
flyctl auth login- Set secrets:
flyctl secrets set TOKEN=your_token
flyctl secrets set DATABASE_URL=your_neon_url
flyctl secrets set CLIENT_ID=your_client_id
flyctl secrets set GUILD_ID=your_guild_id
flyctl secrets set ADMIN_KEY=your_key- Deploy:
bun run deploy- Setup (one time):
flyctl ssh console
bun run register.js
bun run init-db.js
exit-
Access your bot:
- Health:
https://druth-or-tare.fly.dev/ - Admin:
https://druth-or-tare.fly.dev/admin
- Health:
-
Monitor:
bun run logs# View logs
flyctl logs -f
# Check status
flyctl status
# Restart app
flyctl apps restart
# SSH into machine
flyctl ssh console
# Check secrets
flyctl secrets list| Variable | Description | Required |
|---|---|---|
TOKEN |
Discord Bot Token | ✅ Yes |
CLIENT_ID |
Discord Application ID | ✅ Yes |
GUILD_ID |
Discord Server ID | ✅ Yes |
DATABASE_URL |
Neon PostgreSQL connection string | ✅ Yes |
ADMIN_KEY |
Web interface key | ✅ Yes |
PORT |
Server port (default: 3000) | ❌ No |
- Read Messages/View Channels
- Send Messages
- Embed Links
- Use Slash Commands
- Read Message History
GuildsGuildMessagesMessageContentGuildMembers
- Access
/adminendpoint (local:http://localhost:3000/admin) - Enter admin key
- Select type and add question
- Questions are immediately available (no restart needed!)
Edit data/questions.js and run:
bun run init-db- Bot and web interface run on the same port
- Single deployment, single process
- Efficient resource usage
- Uses
Mapto track active player per channel - Prevents multiple simultaneous games in same channel
- Clears state after each round
- Pre-fetches all guild members on startup
- Reduces API calls and prevents rate limiting
- Filters out bot accounts automatically
- Graceful error messages for users
- Comprehensive logging
- Handles rate limits and API failures
- Truth/Dare/Random - Only active player can click
- Skip - Any player except active player can skip
- Spin Again - Starts new round with new player
- HTTP endpoint on port 3000
- Returns bot status and formatted uptime
- Used by Fly.io for health checks
- Check if bot is online:
/ping - Verify slash commands are registered:
bun run register - Check bot has proper permissions in server
- Bot is being rate limited
- Wait a few seconds and try again
- Check bot has
GuildMembersintent enabled
- Verify
DATABASE_URLis correct - Check Neon database is active
- Run
bun run init-dbto initialize
- Check logs:
flyctl logs - Verify all secrets are set:
flyctl secrets list - Ensure Dockerfile builds locally:
docker build .
- Questions reload automatically after adding via web
- Check database has questions: SSH and query
- Verify
DATABASE_URLis correct
- Check bot is running:
flyctl status - Verify URL:
https://your-app.fly.dev/admin - Check
ADMIN_KEYsecret is set
Contributions are welcome! The project follows a modular structure:
- Add new commands in
src/commands/ - Add database functions in
src/database/ - Add utilities in
src/utils/ - Update configuration in
src/config/
- Fork the repository
- Create a feature branch
- Make your changes
- Test locally
- Submit a pull request
Created with ❤️ by Handika Tri Arlan
Built using Bun and Discord.js
- Discord.js - Discord API wrapper
- Bun - Fast JavaScript runtime
- Neon - Serverless PostgreSQL
- Fly.io - Deployment platform
- Issues: GitHub Issues
- Discussions: GitHub Discussions
If you find this project useful, please consider giving it a star! ⭐
Note: This bot is designed for Indonesian-speaking Discord communities. All questions and dares are in Bahasa Indonesia.
Live Demo: Try the bot in action! Invite Link