A privacy-first, lightweight Discord bot that sends notifications when users join or leave voice channels. Built with TypeScript and designed for self-hosting with only essential dependencies.
- Smart Notifications: Sends join/leave notifications with configurable delays to prevent spam
- Privacy-First: No external tracking, databases, or user data storage
- Configurable: Separate channels for join/leave, customizable timing, logging levels
- Production Ready: Health monitoring, graceful shutdown, notification retry mechanism, server logging
- Built-in Monitoring: Discord slash command for bot status and server statistics
- HTTP Health Endpoint: RESTful health check endpoint for uptime monitoring and external health checks
- Modern Architecture: TypeScript, modular design, comprehensive error handling
- Self-Hosting: Deploy anywhere - no external services required
- No External Connections: Only connects to Discord API
- No Persistent Storage: All data stored in memory only
- No User Tracking: No analytics, metrics, or behavior tracking
- No Database: Zero database dependencies or external data storage
- Local Logs Only: All logging happens locally with configurable levels
- Ephemeral Commands: Status commands are private to the user who runs them
You have complete control - inspect the code, audit dependencies, host it yourself.
π **Alice** joined voice channel **general**
π **Bob** left voice channel **gaming**
- Node.js 18.0.0 or higher
- A Discord Application with bot token
- Basic command line knowledge
git clone https://github.com/alex-ak/discord-voice-notifications.git
cd discord-voice-notifications
npm install
cp .env.example .env
# Edit .env with your Discord bot token and channel ID(s)
Required environment variables:
DISCORD_TOKEN=your_bot_token_here
NOTIFY_CHANNEL_ID=your_channel_id_here
or
JOIN_NOTIFY_CHANNEL_ID=your_join_channel_id_here
LEAVE_NOTIFY_CHANNEL_ID=your_leave_channel_id_here
- Go to Discord Developer Portal
- Create a new application
- Go to "Bot" section and create a bot
- Copy the bot token to your
.env
file
Generate Invite URL:
Scopes:
bot
(basic bot permissions)applications.commands
(for slash commands)
Bot Permissions:
View Channels
(to access channels)Send Messages
(to send notifications)
URL Generation: Use the Discord Developer Portal OAuth2 URL Generator to invite your bot to a server, it should look like this:
https://discord.com/api/oauth2/authorize?client_id=YOUR_BOT_CLIENT_ID&permissions=3072&scope=bot%20applications.commands
Note: The permissions value
3072
represents "View Channels" (1024) + "Send Messages" (2048).
Add to Server:
- Open the generated invite URL in your browser
- Select the Discord server where you want to add the bot
- Review the permissions and click "Authorize"
- Complete any CAPTCHA if prompted
# Verify setup (optional but recommended)
npm run verify
# Development
npm run dev
# Production
npm run build
npm start
You should see:
β
Bot logged in as YourBot#1234
π’ Monitoring voice channel activity...
π₯ Join notifications: Channel ID 123456789
π€ Leave notifications: Channel ID 123456789
β
Slash commands registered successfully
If bot commands don't appear immediately:
- Restart Discord client
- Check bot permissions
- Verify the bot has
applications.commands
scope
DISCORD_TOKEN=your_bot_token_here
NOTIFY_CHANNEL_ID=your_channel_id_here
DISCORD_TOKEN=your_bot_token_here
JOIN_NOTIFY_CHANNEL_ID=your_join_channel_id_here
LEAVE_NOTIFY_CHANNEL_ID=your_leave_channel_id_here
MINIMUM_SESSION_TIME=10000 # 10 seconds (prevents spam from quick joins/leaves)
RETRY_DELAY=2000 # 2 seconds (retry delay for failed notifications)
LOG_LEVEL=INFO # ERROR, WARN, INFO, DEBUG
# Health Endpoint Configuration
HEALTH_PORT=3000 # Port for the health check HTTP endpoint (default: 3000)
ENABLE_HEALTH_ENDPOINT=true # Enable health endpoint (default: true)
Use the /status
slash command in Discord to get detailed bot information including health status, memory usage, server statistics, and configuration settings. See COMMANDS.md for full details.
The bot provides an HTTP health endpoint for uptime monitoring and external health checks:
Endpoint URL: http://localhost:3000/health
(or your configured port)
Response Format:
{
"status": "healthy",
"timestamp": "2025-07-05T10:30:00.000Z",
"uptime": 3600,
"discord": {
"connected": true,
"ping": 45,
"guilds": 1,
"users": 150,
"voiceChannels": 5
},
"system": {
"memoryUsageMB": 85,
"memoryTotalMB": 128
}
}
Status Codes:
200
- Bot is healthy and Discord connection is working503
- Bot is unhealthy (Discord disconnected or other issues)500
- Internal server error
Configuration:
- Set
HEALTH_PORT=3000
to change the port (default: 3000) - Set
ENABLE_HEALTH_ENDPOINT=false
to disable the endpoint
Uptime Monitoring:
You can use the /health
endpoint with services like:
- UptimeRobot: Monitor the endpoint URL
- Prometheus: Scrape the JSON response
- AWS Application Load Balancer: Use as health check target
- Any HTTP monitoring service
npm run dev
npm run build
npm start
Please see CONTRIBUTING.md for guidelines.
- TypeScript with strict mode
- Prettier for formatting (
npm run format
) - ESLint for linting (
npm run lint
) - Clear documentation and comments
MIT License - see LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Commands Documentation
- Release Notes: Version History
- Built with discord.js
- Inspired by I built something that changed my friend group's social fabric