A Discord bot that announces when users join voice channels, with support for public and private channels.
- Public Channel Announcements: Announce when users join public voice channels
- Private Channel Announcements: Announce when users join private voice channels (admin-only setup)
- Multi-Server Support: Works across multiple Discord servers
- Permission-Based Setup: Different permission levels for public vs private channels
- TypeScript: Built with TypeScript for better type safety and development experience
- Rich Embeds: Beautiful embed messages with interactive timestamps that display in each user's local timezone
Use this link to invite the bot to your server with the correct permissions:
https://discord.com/oauth2/authorize?client_id=1347826239804538894&permissions=397553134592&integration_type=0&scope=bot+applications.commands
-
Clone the repository
git clone <repository-url> cd Voice-Channel-New-Session-Announcer
-
Install dependencies
npm install
-
Set up environment variables Create a
.envfile in the root directory:DISCORD_BOT_TOKEN=your_discord_bot_token_here
-
Build the project
npm run build
npm run dev # Start development server with linting and type checkingnpm start # Build and start with PM2npm run stop # Stop the bot
npm run restart # Restart the botnpm run lint # Run ESLint with auto-fix
npm run type-check # Run TypeScript type checking
npm run format # Format code with Prettier/change-vc-notify-role @role- Change the role used for VC notifications (requires Manage Roles permission)
Note: Commands are automatically registered with Discord when the bot starts. If you don't see commands immediately, wait a few minutes for them to appear globally.
The bot automatically creates and manages a notification role for each server:
- Default Role Name:
voice-notifications - Customizable: Admins can rename the role using Discord's built-in role management
- Role Selection: Use
/change-vc-notify-roleto select which role gets mentioned in notifications - Mentionable: The role is set to be mentionable for notifications
The bot requires the following permissions to function properly:
- View Channels - To see voice channels and their states
- Send Messages - To send announcements in text channels
- Embed Links - To send rich embed messages with timestamps
- Mention Everyone - To mention roles/users in announcements
- Read Message History - To find and update previous session messages
- Use Slash Commands - To register and use slash commands (via
applications.commandsscope)
- Manage Roles - Required for the
/change-vc-notify-rolecommand - Manage Messages - For future features like deleting old messages or pinning important ones
Follow these steps to invite the bot to your server with the proper permissions:
- Go to the Discord Developer Portal
- Select your application
- Navigate to OAuth2 > URL Generator
Under Scopes, select:
- ✅
bot - ✅
applications.commands
Under Bot Permissions, select:
Required Permissions:
- ✅ View Channels
- ✅ Send Messages
- ✅ Embed Links
- ✅ Mention Everyone
- ✅ Read Message History
Optional Permissions (for advanced features):
- ✅ Manage Roles (for role management command)
- ✅ Manage Messages (for future message management features)
- Copy the generated URL from the bottom of the page
- Open the URL in your browser
- Select your server from the dropdown
- Click "Authorize"
- Complete the CAPTCHA if prompted
After inviting the bot:
- Go to your server's Server Settings > Roles
- Find the bot's role and ensure it has the necessary permissions
- Check that the bot's role is positioned above any roles it needs to mention
If the bot can't see a channel you're trying to set as an announcement channel:
- Check that the bot has the "View Channel" permission for that channel
- Ensure the bot's role is above the channel's permission overwrites
- Verify the bot has the necessary permissions at the server level
If the bot can't send messages:
- Check that the bot has "Send Messages" permission in the target channel
- Ensure the bot has "Embed Links" permission for rich messages
- Verify the bot's role has the correct permissions
If slash commands aren't working:
- Ensure the bot has the
applications.commandsscope - Check that the bot has "Use Slash Commands" permission
- Wait a few minutes for commands to register globally
If you're seeing duplicate announcements:
- Check if multiple bot instances are running
- Use
pm2 listto see running processes - Stop any duplicate instances with
pm2 stop <process-name>
src/
├── commands/ # Slash command handlers
├── events/ # Discord event handlers
├── utils/ # Utility functions
├── types/ # TypeScript type definitions
├── services/ # Business logic services
└── config/ # Configuration files
The project uses a modern TypeScript configuration with:
- Strict type checking for better runtime safety
- Path aliases for cleaner imports (
@/utils/functions) - Modern ES2021 target for better performance
- Source maps for debugging
- ESLint with TypeScript support for code quality
- Prettier for consistent code formatting
- TypeScript for type safety and IntelliSense
The development server (npm run dev) automatically:
- Runs ESLint to check code quality
- Performs TypeScript type checking
- Starts the bot with hot reloading
- Permission validation: Create reusable utility functions for channel permission checks
- Response patterns: Standardize error/success response handling
- Type safety: Replace
anytypes with proper interfaces - Error handling: Implement centralized error handling and logging
- Caching: Implement guild data caching
- Rate limiting: Add command rate limiting
- Database: Consider migrating from JSON files to a proper database
This project is licensed under the MIT License.