- JavaScript 99.6%
- Dockerfile 0.4%
|
|
||
|---|---|---|
| .woodpecker | ||
| commands | ||
| .dockerignore | ||
| .gitignore | ||
| bridgehandler.js | ||
| commands.js | ||
| database.js | ||
| Dockerfile | ||
| eslint.config.js | ||
| example.env | ||
| index.js | ||
| interactions.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| renovate.json | ||
| utils.js | ||
| voicehandler.js | ||
Temp-Voice-URC
A Discord bot that creates temporary voice channels with admin panels. Users can join a spawn channel to automatically get their own private voice channel with a dedicated admin text channel and control panel.
Features
- Automatic Channel Creation: When a user joins a spawn channel, a temporary voice channel and admin text channel are automatically created
- Admin Control Panel: Each temporary channel comes with a dedicated text channel containing a control panel with buttons for:
- ✏️ Rename the voice channel
- 👢 Kick all members
- ➕ Add role permissions
- ➖ Remove role permissions
- Auto-Cleanup: Temporary channels are automatically deleted when empty
- Persistent Settings: User names and spawn channel configurations are saved to SQLite database
- Slash Commands: Easy-to-use commands for server administrators to manage spawn channels
- Permission Checking: Built-in command to verify bot permissions
- Bridge: Connect text channels across multiple Discord servers to sync messages in real time
Prerequisites
- Node.js 18 or higher
- npm (Node Package Manager)
- A Discord bot token and client ID
- Docker (optional, for containerized deployment)
Installation
Local Development
- Clone the repository:
git clone <repository-url>
cd Temp-Voice-URC
- Install dependencies:
npm ci
- Create a
.envfile:
cp example.env .env
- Edit the
.envfile with your bot credentials:
BOT_TOKEN=your_bot_token_here
CLIENT_ID=your_client_id_here
- Run the bot:
node index.js
Configuration
Environment Variables
| Variable | Description | Required |
|---|---|---|
BOT_TOKEN |
Your Discord bot token | Yes |
CLIENT_ID |
Your Discord application client ID | Yes |
Getting Bot Credentials
- Go to the Discord Developer Portal
- Create a new application or select an existing one
- Navigate to the Bot section and create a bot
- Copy the Token (keep this secret!)
- Navigate to OAuth2 → General and copy the Application ID (this is your CLIENT_ID)
- Under Bot, enable the following intents:
- Server Members Intent
- Message Content Intent
Usage
Setting Up Spawn Channels
There are two ways to set up spawn channels:
Option A – Create a new channel (/createspawn):
Creates a brand new voice channel that immediately acts as a spawn.
- Create a category where temporary channels will be created
- Use
/createspawn:/createspawn category:<category> name:<optional_name>category: The category where temp channels will be created (required)name: Name of the spawn channel (optional, defaults to "🎧 Temp Voice Spawn")
Option B – Register an existing channel as a spawn (/spawn add):
Registers an already existing voice channel as a spawn without recreating it.
-
Use
/spawn add:/spawn add kanal:<voice-channel> kategorie:<category>kanal: The existing voice channel to register as spawn (required)kategorie: The category where temp channels will be created (required)
-
To remove a spawn registration without deleting the channel:
/spawn remove kanal:<voice-channel> -
To list all registered spawns on the server:
/spawn list
Users can now join any registered spawn channel to get their own temporary voice channel.
Slash Commands
| Command | Description | Usage |
|---|---|---|
/createspawn |
Creates a new spawn channel | /createspawn category:<category> [name:<name>] |
/removespawn |
Removes a spawn channel and deletes it | /removespawn channel:<channel> |
/spawn add |
Registers an existing voice channel as spawn | /spawn add kanal:<channel> kategorie:<category> |
/spawn remove |
Unregisters a spawn channel (channel is not deleted) | /spawn remove kanal:<channel> |
/spawn list |
Lists all registered spawn channels | /spawn list |
/permissions |
Shows bot permissions status | /permissions |
/checkcategory |
Shows bot permissions for a category | /checkcategory category:<category> |
/bridge create |
Creates a new bridge group | /bridge create name:<name> |
/bridge add |
Adds a text channel to a bridge | /bridge add kanal:<channel> bridge:<name> |
/bridge remove |
Removes a text channel from a bridge | /bridge remove kanal:<channel> |
/bridge list |
Lists all active bridges | /bridge list |
/bridge delete |
Deletes an entire bridge group | /bridge delete name:<name> |
Admin Panel Buttons
When a user joins a spawn channel, they receive:
- A private voice channel (named after them or their saved name)
- A private admin text channel with a control panel
Button Functions:
- ✏️ Rename: Send a new name in the chat to rename the voice channel
- 👢 Kick: Kicks all members except the owner from the voice channel
- ➕ Add Role: Add a role to have access to the voice channel
- ➖ Remove Role: Remove a role's access to the voice channel
Bridge – Connecting Text Channels Across Servers
The bridge feature allows you to sync messages between text channels on different Discord servers. Messages are forwarded via webhooks and appear with the sender's username and avatar.
Note: The bot must be invited to all servers you want to connect, and needs the Manage Webhooks permission in each bridged channel.
Setup:
-
Create a bridge (only needs to be done once, on any server):
/bridge create name:global-chat -
Add a channel on Server A:
/bridge add kanal:#your-channel bridge:global-chat -
Add a channel on Server B (same bridge name!):
/bridge add kanal:#your-channel bridge:global-chat
Messages sent in either channel will now appear in both. They are displayed as:
Username • Server Name Hello everyone! 👋
Bot Permissions
The bot requires the following permissions in your server:
| Permission | German Name |
|---|---|
| Manage Channels | Kanäle verwalten |
| Send Messages | Nachrichten senden |
| Manage Messages | Nachrichten verwalten |
| Move Members | Mitglieder verschieben |
| Manage Roles | Rollen verwalten |
| View Channels | Kanäle anzeigen |
| Connect | Verbinden |
| Manage Webhooks | Webhooks verwalten |
Category permissions:
| Permission | German Name |
|---|---|
| Manage Channels | Kanäle verwalten |
| View Channel | Kanal anzeigen |
| Send Messages | Nachrichten senden |
| Connect | Verbinden |
Use the /permissions and /checkcategory command to check if your bot has all required permissions.
Docker Deployment
Build Docker Image (locally)
docker build -t temp-voice-urc .
Run with Docker
docker run -d \
--name temp-voice-urc \
-e BOT_TOKEN=your_bot_token \
-e CLIENT_ID=your_client_id \
-v $(pwd)/data:/app/data \
temp-voice-urc
Docker Compose (recommended)
Create a docker-compose.yml file:
version: '3.8'
services:
bot:
build: .
container_name: temp-voice-urc
environment:
- BOT_TOKEN=${BOT_TOKEN}
- CLIENT_ID=${CLIENT_ID}
volumes:
- ./data:/app/data
restart: unless-stopped
Run with:
docker-compose up -d
Project Structure
Temp-Voice-URC/
├── .gitignore # Git ignore rules
├── .woodpecker/ # CI/CD configuration
├── commands/ # Slash command handlers
│ ├── bridge.js # /bridge command logic
│ ├── checkcategory.js # /checkcategory command logic
│ ├── createspawn.js # /createspawn command logic
│ ├── permissions.js # /permissions command logic
│ ├── removespawn.js # /removespawn command logic
│ └── spawn.js # /spawn add, remove, list logic
├── data/ # SQLite database directory (auto-created)
├── bridgehandler.js # Bridge message forwarding logic
├── commands.js # Discord slash command registration
├── database.js # SQLite database setup and initialization
├── Dockerfile # Docker container configuration
├── eslint.config.js # ESLint configuration
├── example.env # Example environment variables
├── index.js # Main bot application
├── interactions.js # Slash command & button interaction handler
├── utils.js # Shared utilities and helpers
├── voicehandler.js # Voice state update handler
└── README.md # This file
Database
The bot uses SQLite (via better-sqlite3) for persistent storage. The database is stored in ./data/data.db and contains:
- Spawn channel configurations: Maps spawn channel IDs to category IDs per guild (stored as
spawn-list-<guildId>andspawn-<guildId>-<channelId>) - Temporary voice channels: Persists active temp channels across restarts
- User names: Saves custom channel names for users
- Voice roles: Saves per-user role permissions that are restored on channel recreation
- Bridges: Stores bridge groups and their connected channels with webhook URLs