Skip to content

ak811/temp-vc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TempVoice Bot

A Discord bot that creates temporary voice channels on demand and gives the channel creator a clean set of owner controls (lock/unlock, allow/block, rename, limit, region, chat toggles, and basic moderation). Channels auto-delete when empty, so your server stays tidy. Humans love clutter. This bot doesn’t.


What it does

  • Join-to-Create (JTC): users join a designated “Join to Create” voice channel, the bot spawns a fresh temp VC, and moves them in.
  • Auto-cleanup: temp VCs are deleted when empty.
  • Owner controls: the channel owner can manage access, chat permissions, limits, region, and members.
  • Persistent overrides: allow/block rules are stored in SQLite and re-applied when users rejoin (and survive unlock/reset workflows).
  • Quick reference: optional one-time command quickref embed in the new VC.

Features

Join-to-Create

  • Admins configure a JTC voice channel with !vc set_channel.
  • Optionally configure a category where temp VCs should be created with !vc set_category.
  • Temp VCs are created open by default (connect + text-in-voice chat enabled for @everyone).

Temp VC lifecycle

  • A temp VC is tracked in SQLite (temp_vcs).
  • When the last user leaves, the bot deletes the channel and its DB rows.

Owner controls

Owners can:

  • Rename the channel (with an emoji prefix)
  • Set user limit (0–99)
  • Set voice region (or auto)
  • Lock/unlock join access
  • Allow/block specific users (persisted)
  • Clear overrides (single user or all)
  • Open/close text-in-voice chat
  • Kick/mute/unmute/summon members
  • Claim ownership when the original owner leaves
  • Transfer ownership to a current member

Command summary

All commands live under !vc (aliases: !temp_vc, !temp, !tv, !temp_voice).

Admin setup (Manage Server)

  • !vc set_channel <voice-channel>
    Sets the Join-to-Create voice channel.
  • !vc set_category <category> (optional)
    Sets the category where temp VCs are created.

Info

  • !vc
    Shows a quick command reference.
  • !vc info
    Shows a fuller reference including admin setup.

Owner (in your temp VC)

  • !vc rename <name>
  • !vc limit <0-99>
  • !vc region [name] (run without args to list regions)
  • !vc lock / !vc unlock
  • !vc allow @user / !vc block @user / !vc clear [@user]
  • !vc status
  • !vc reset
  • !vc openchat / !vc closechat
  • !vc kick @user
  • !vc mute @user / !vc unmute @user
  • !vc summon @user
  • !vc claim
  • !vc transfer @user

Owner-only commands require you to be inside a managed temp VC and to be the recorded owner in the DB.


Permissions the bot needs

Minimum required permissions depend on features you use. For full functionality, grant the bot:

  • Manage Channels (create/edit/delete VCs, set permissions, region, user limit)
  • Move Members (move users into the new VC; kick/summon)
  • View Channels
  • Send Messages (for command responses in text channels)
  • Embed Links (for pretty embeds)
  • Read Message History (optional but helpful)
  • Connect / Speak (not required unless you add voice audio features later; this bot does not play audio)

Also, enable privileged intents in the Discord Developer Portal:

  • Server Members Intent (this repo enables intents.members = True)
  • Message Content Intent (this repo enables intents.message_content = True)

Installation

1) Requirements

  • Python 3.11
  • A Discord bot application + token
  • (Optional) Conda, if you want to use environment.yml

2) Clone & install

git clone <your-repo-url>
cd temp-vc
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate

pip install -r requirements.txt

Or with conda:

conda env create -f environment.yml
conda activate tempvoice

3) Configure environment

Create a .env file (same folder as requirements.txt) using .env.example as a template:

DISCORD_TOKEN="your_token_here"
# Optional:
TV_DB_PATH="data/tempvoice.sqlite"

4) Run

python -m src

(or)

python src/main.py

On startup the bot initializes the SQLite schema and logs in.


First-time server setup

  1. Create (or pick) a voice channel named something like Join to Create.
  2. Invite the bot with the permissions listed above.
  3. In a text channel, as an admin:
    • !vc set_channel <your-join-to-create-voice-channel>
    • (optional) !vc set_category <your-category>
  4. Test by joining the JTC channel.

Data storage

SQLite database file is controlled by:

  • TV_DB_PATH env var (default: data/tempvoice.sqlite)

Tables:

  • guild_settings: stores JTC channel id + optional category id
  • temp_vcs: tracks managed temp channels and their properties
  • temp_vc_overrides: per-channel allow/block rules for users (connect/chat)

The bot uses WAL mode to reduce lock contention (PRAGMA journal_mode=WAL;).


Configuration knobs

In src/config.py:

  • DEFAULT_PREFIX (default !)
  • PRIMARY_GROUP (default vc)
  • GROUP_ALIASES
  • RTC_REGIONS list (includes auto)
  • Feature flags:
    • FF_SEND_JOIN_LEAVE_MESSAGES (default False)
    • FF_QUICKREF_ON_OWNER_FIRST_JOIN (default True)

How the owner system works

  • When a temp VC is created, the joiner becomes the recorded owner in temp_vcs.owner_user_id.
  • Owner checks are enforced via a DB lookup (is_temp_vc_owner()).
  • !vc claim lets someone else claim ownership only if the current owner is no longer in the channel.
  • !vc transfer sets a new owner only if that member is currently in the VC.

License

MIT. See LICENSE.

About

TempVoice Bot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages