Skip to content

math280h/voiceofthetimes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🎵 Voice of The Times

CI License: MIT Built with Bun

A Discord bot that manages voice channels with user-controlled limits and automatic scaling. Named as a play on Harry Styles' "Sign of the Times".

Commands

Command Description Permission
/voicelimit set <limit> Set the channel user limit (0-99, 0 = unlimited) Leader or override role
/voicelimit remove Remove the channel user limit Leader or override role
/voicelimit info Show leader, member count, and limit Anyone in the channel
/lead transfer <user> Transfer leadership to another member in the channel Leader or override role
/lead info Show the current channel leader Anyone in the channel
/ping Check that the bot is responding and view latency Everyone

Setup

Requires Bun, Docker (for PostgreSQL), and a bot token from the Discord Developer Portal.

  1. Install dependencies: bun install
  2. Copy .env.example to .env and fill in your credentials (see Configuration).
  3. Start the database: docker compose up -d
  4. Run the bot: bun run dev (or bun run start for production).

On startup the bot initializes the database schema, deploys its slash commands, and syncs existing voice channels.

Configuration

Set these as environment variables (typically in .env):

Variable Required Default Description
DISCORD_TOKEN yes Bot token
DISCORD_CLIENT_ID yes Bot client ID
MANAGED_CATEGORIES yes Comma-separated category IDs to manage
CATEGORY_NAMES no Voice 1, Voice 2, ... Channel-name labels, in the same order as MANAGED_CATEGORIES. Does not rename the Discord category itself
CHANNEL_NAME_TEMPLATE no {category} {number} Name template; supports {category} and {number}
MIN_TOTAL_CHANNELS no 3 Minimum total channels per category
BUFFER_CHANNELS no 1 Minimum empty channels kept available per category
OVERRIDE_ROLE_ID no Role allowed to manage any channel
DATABASE_URL no postgres://postgres:postgres@localhost:5432/vott PostgreSQL connection string
LOG_LEVEL no info debug, info, warn, or error
NODE_ENV no development development or production

To find IDs, enable Developer Mode (User Settings -> Advanced), then right-click a category or role and Copy ID.

The default database credentials are for local development only. Before running anywhere exposed, set a strong POSTGRES_PASSWORD and update DATABASE_URL to match.

For a single category you can use the legacy MANAGED_CATEGORY_ID and CATEGORY_NAME variables instead.

How it works

  • Leadership: the first person to join a channel becomes its leader and can set the user limit or transfer leadership. Leadership passes to the next member when the leader leaves and is cleared once the channel empties.
  • Auto-scaling: after every join or leave, the bot keeps at least MIN_TOTAL_CHANNELS channels and BUFFER_CHANNELS empty ones per category, creating or deleting channels as needed. Occupied channels are numbered first.
  • Override: members with OVERRIDE_ROLE_ID or the Administrator permission can manage any channel.

With MIN_TOTAL_CHANNELS=3 and BUFFER_CHANNELS=1, the bot creates 3 channels when none exist, and adds one more whenever every channel is occupied so an empty one is always available.

Development

bun run dev          # run with auto-reload
bun run typecheck    # type-check
bun run lint         # lint
bun run format:fix   # format
bun test             # unit tests

See CONTRIBUTING.md before opening a pull request, and review our Code of Conduct.

License

MIT

About

A Discord bot that manages voice channels with user-controlled limits and automatic scaling.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Contributors