A self-hosted Discord bot for dynamic temporary voice channel management with a fully interactive dashboard panel, database persistence, and advanced member control features.
- πΎ Database-backed server configuration β Server setup (category, creator channel) is now persisted in SQLite, surviving bot restarts
- ποΈ Channel ownership tracking β All temporary channels are tracked in a dedicated database with owner, category, and creation timestamps
- βοΈ Server registration system β New
/registerand/unregisterand/setupcommands to set up and tear down bot configuration per server - π On-demand voice channel recovery β Channels created before the last bot offline period are automatically recovered on startup
- π Ownership persistence β Channel owner data survives across bot restarts via database
- π New database modules β
database_server_operations.pyanddatabase_channel_operations.pyfor structured data handling - π― Per-channel cooldowns β Panel button cooldowns now apply per-channel instead of globally
- π Multi-Server Operation Capability β Persistence database storage allows multiple server operations
- π On-start VC recovery β Automatic channel creation for users in the creator channel when bot comes online
- ποΈ Orphan channel cleanup β Automatic deletion of channels with no ownership records
- π Permission overwrite fixes β Fixed chat permissions for locked channels
- β±οΈ Per-channel cooldowns β Cooldowns run per channel instead of globally
- β Trust/Untrust sync β Consistent permission checking across slash commands and panel buttons
- π‘οΈ Guild checks β Server-only command validation
- ποΈ Interactive Panel β TempVoice-style UI with buttons for all channel controls
- π¨ Native Member Search β Discord's built-in user picker for invite, trust, and block
- π Smart Claim System β Automatic ownership recovery for abandoned channels
- π Panel sent into temp VC β No extra channels needed; panel appears directly in created voice channels
- β Auto-creates a personal voice channel when a user joins the "Create VC" channel
- β Automatically recovers and creates channels for users already in creator channel on bot startup
- β Automatically deletes empty channels when everyone leaves
- β Automatically cleans up orphaned channels (no database record) periodically
- β Full ownership system with claim and transfer support
- β Rich set of slash commands for complete channel management
- β Interactive button panel with modals and user selectors
- β Persistent server configuration (survives restarts)
- β Channel ownership tracking with timestamps
- β Server registration & unregistration
- β Comprehensive member permission control (trust, block, kick)
- β Lock/Unlock channels
- β Hide/Show from channel list
- β Trust members (full access even when locked)
- β Block members (kick and permanent ban)
- β Individual permission overwrites
βββ main.py # Bot entry point and configuration
βββ config.py # Cooldown and limit constants
βββ logger.py # Error and info logging setup
βββ cogs/
β βββ voice_manager.py # Auto voice channel creation, deletion, and cleanup
β βββ voice_interface.py # Interactive panel UI (buttons, modals, selects)
β βββ voice_controls.py # All slash commands for channel control
β βββ error_handling.py # Global error handler
β βββ sync_command.py # Slash command sync and help utilities
β βββ databaseio.py # High-level database I/O wrapper
βββ database_server_operations.py # Server table CRUD operations
βββ database_channel_operations.py # Channel table CRUD operations
βββ .env # Environment variables (create this)
git clone https://github.com/code-1py/VoiceForge.git
cd VoiceForgepip install discord.py python-dotenv pydanticCreate a .env file in the root directory:
# Discord Bot Token
VOICE_BOT_TOKEN=your_bot_token_here
# Database names (optional - defaults provided)
SERVER_DB_NAME=discord_server.db
CHANNEL_DB_NAME=discord_channel.dbpython main.py-
Create a Category where temporary voice channels will be created
- This is where all user-created voice channels will appear
- Assign permissions to everyone roles for
connect,video,speak,view channel,voice activity,send message,read message history
-
Create a Voice Channel inside that category
- This will be the "Create VC" trigger channel
- Users join this channel to get their own personal voice channel
- Name it something like
β Create VCorπ€ Join for VC - Optional create a text channel like
β¨γ»voice-controlswith no message permissions and use/panelto send panel interface in channel
-
Set Bot Permissions
- Ensure the bot has administrator permissions in the server
First-time setup requires a server registration command:
/setup
Shows instructions to setup bot in server.
/register
This stores your category and creator channel configuration in the database, enabling persistent operation across bot restarts.
To remove the bot from a server:
/unregister
When a user joins the Create VC channel, a panel is automatically sent inside their new voice channel with the following controls:
| Button | Icon | Description | Owner Only |
|---|---|---|---|
| Lock | π | Block others from joining | β |
| Unlock | π | Allow others to join | β |
| Hide | π | Hide from channel list | β |
| Show | ποΈ | Make visible in channel list | β |
| Rename | βοΈ | Change channel name (max 32 chars) | β |
| Set Limit | π₯ | Cap max members (0 = unlimited) | β |
| Invite | π¨ | Search and allow a member to join | β |
| Kick | π’ | Disconnect a member from channel | β |
| Ban | π« | Search and block a member | β |
| Trust | β | Search and give full permissions | β |
| Untrust | β | Remove a member's trust | β |
| Unblock | βοΈ | Remove a member's ban | β |
| Transfer | π | Give ownership to someone else | β |
| Claim | π | Claim an abandoned channel | β |
| Delete | ποΈ | Delete your channel permanently | β |
Note: All controls are owner-only except Claim, which anyone in the channel can use.
You can manually send a panel to any voice channel using:
/panel
Requires Manage Channels permission.
| Command | Description |
|---|---|
!syncguild |
Sync slash commands to the current server |
!syncglobal |
Sync slash commands globally |
!clearguild |
Clear all guild slash commands |
!clearglobal |
Clear all global slash commands |
Note: These commands are restricted to the bot owner. Use them after updating commands to make changes visible to users.
| Command | Description |
|---|---|
/register |
Register this server to use the bot (save config to database) |
/unregister |
Unregister this server and remove all data |
/setup |
Shows instructions to setup bot in server |
| Command | Description | Cooldown |
|---|---|---|
/rename <name> |
Rename your voice channel (max 32 characters) | 300s |
/limit <number> |
Set user limit (1β99), or 0 to remove | 3s |
/delete |
Delete your voice channel | 5s |
/lock |
Lock the channel so no one can join | 4s |
/unlock |
Unlock the channel | 4s |
/hide |
Hide the channel from everyone | 5s |
/unhide |
Make the channel visible again | 5s |
| Command | Description | Cooldown |
|---|---|---|
/claim |
Claim an unowned or abandoned channel | 90s |
/transfer <member> |
Transfer ownership to another member | 90s |
| Command | Description | Cooldown |
|---|---|---|
/kick <members> |
Kick up to 5 members from your channel | 2s |
/invite <members> |
Send a DM invite to up to 5 members | 5s |
/trust <members> |
Allow up to 5 members to view/join even if locked or hidden | 4s |
/untrust <members> |
Remove up to 5 members from the trusted list | 4s |
/trusted |
View the trusted members list | 3s |
/block <members> |
Kick and block up to 5 members | 3s |
/unblock <members> |
Remove up to 5 members from the blocked list | 3s |
/blocked |
View the blocked members list | 3s |
| Command | Description |
|---|---|
/help |
Shows all available slash commands |
/panel |
Manually send the control panel to a voice channel |
Stores server configuration and setup information.
servers
βββ id (PK)
βββ server_id (unique)
βββ category_id (where temp channels go)
βββ creator_channel_id (join to create VC)
βββ created_at
βββ updated_at
Tracks all temporary voice channels and ownership.
serversChannels
βββ id (PK)
βββ server_id
βββ owner_id
βββ category_id
βββ channel_id (unique)
βββ created_at
βββ updated_at
Logs are stored in the Logs/ directory:
VOICE_BOT.logβ General bot activity, startup logs, and voice channel eventserror.logβ Detailed error traces with timestamps and locations
- Timestamp: All errors include ISO format timestamps
- Traceback: Full Python traceback for debugging
- Location: Error location includes file name and function name
Example error log entry:
2024-01-15 10:45:23,456 - ERROR - Location : create_temp_voice_channel - file : voice_manager.py : Error Name - HTTPException - traceback :
Traceback (most recent call last):
File "voice_manager.py", line 120, in create_temp_voice_channel
...
Register a server:
/register
This creates a server entry in the database with the configured category and creator channel.
Unregister a server:
/unregister
This removes all server configuration and associated channel data from the database.
Channels are automatically tracked when created. The database records:
- Owner ID
- Server ID
- Category ID
- Channel ID
- Creation timestamp
When channels are deleted (empty or manually), database records are cleaned up automatically.
- β Channel ownership is persisted in the database
- β Ownership data survives bot restarts
- β
Use
/claimto take ownership of a channel without a registered owner
- All voice control commands only work inside channels created by this bot
- Only the channel owner can use management commands (except
/claim) - Channels are automatically deleted when they become empty (no non-bot members)
- Orphaned channels (in database but deleted in Discord) are cleaned up on startup
- Cooldowns are per-channel, not per-user
- Different commands have different cooldown durations (see Slash Commands above)
- Cooldown timer starts when the command is executed, not when it completes
- Bot caches server configuration on startup for fast lookups
- Database is SQLite (lightweight, file-based)
- Automatic cleanup runs periodically to prevent orphaned records
- Channel member tracking is real-time via Discord events
- Install dependencies:
pip install discord.py python-dotenv pydantic - Create
.envfile with all required variables - Create Discord category and voice channel
- Copy IDs to
.env - Grant bot necessary permissions in the category
- Run
python main.py - In Discord, run
/registerto set up the server - Test by joining the Create VC channel
- (Optional) Run
!syncglobalto register commands globally
- β
Check that you ran
/registerin the server - β
Verify bot has
Manage ChannelsandMove Memberspermissions - β Ensure the creator channel ID is correct
- β
Run
/unregisterand again run/registerin the server to reset server config
- β Check that bot has permission to delete channels in the category
- β Verify the channel is actually empty (no members, not even bots)
- β
Check
error.logfor detailed error information
- β
Run
!syncguild(in the server) or!syncglobal(for all servers) - β Wait a few seconds for Discord to update
- β
Check that
discord_server.dbanddiscord_channel.dbexist in the root directory - β Verify write permissions on the directory
- β
Check
error.logfor detailed database error traces
This project is licensed under the MIT License
For issues, feature requests, or questions:
- Check the GitHub Issues
- Review the logs in the
Logs/directory - Ensure all environment variables are set correctly
Made with β€οΈ by code-1py