#discord #discord-bot

app bobbot

A Discord bot for creating and destroying temporary voice channels

14 releases (3 stable)

1.1.0 May 13, 2023
1.0.1 Nov 8, 2022
1.0.0 Aug 18, 2022
0.10.3 Jan 24, 2022
0.4.0 Nov 3, 2020

#290 in Command line utilities

Download history 1/week @ 2023-10-14 1/week @ 2023-10-21 29/week @ 2023-10-28 1/week @ 2023-11-04 1/week @ 2023-11-11 18/week @ 2023-11-18 50/week @ 2023-11-25 16/week @ 2023-12-02 16/week @ 2023-12-16 32/week @ 2023-12-23 14/week @ 2024-01-06 13/week @ 2024-01-20 80/week @ 2024-01-27

107 downloads per month

AGPL-3.0-or-later

96KB
1.5K SLoC

Bob Bot

A Discord bot for creating and destroying temporary voice channels.

Ever wanted Mumble's temporary voice channels on Discord?
Bob can help you!

Usage

The bot allows everyone on the server to create temporary voice channels in any category containing a text channel where slash commands are enabled.

Creating a temporary voice channel

To create a temporary voice channel, use the /build command while you're connected to voice chat:

/build {name}

A new temporary voice channel will be created, and you will be moved inside it by the bot.

You will have all permissions on that voice channel, as if the administrator of the server gave you the Manage Channel permission on it.

You can use that privilege to create a private voice channel for just you and a few friends, or to allow only a select number of people to talk.

Saving and loading presets

If you find yourself setting often the same permissions on a voice channel, you may want to store them in a preset so you will be able to load them in the future.

You can do so with the /save slash command:

/save {preset} {channel} [overwrite]

If you have the Manage Channels permission on the whole server, you can edit existing presets by specifying the {overwrite} argument.

You will then be able to load the preset with the /build slash command:

/build {name} {preset}

Presets are server-specific, so you don't have to worry about name collisions.

Configuring the bot

Setting the command channel

If you have the Manage Channels permission on the whole server, you'll be able to select the text channel where the bot will send notifications with the /config cc command:

/config cc {channel}

Setting the deletion time

If you have the Manage Guild permission on the whole server, you'll be able to choose the time that temporary channels will be able to stay empty for before they are deleted with the /config dt command:

/config dt {timeout}

Timeouts above 30 minutes are experimental and may cause slowdowns in the bot.

Add to your own server

You can add the bot to your own server by clicking on this link.

Please note that the bot must be an Administrator to work correctly, due to a peculiarity in Discord's permission system, which doesn't allow non-Administrators to create channels with the Manage permissions permission set.

Once you added the bot, set a command channel with /config cc and a deletion time with /config dt, or the bot will refuse to run.

Hosting your own instance

Prerequisites

Installation

  1. Download and compile the bobbot crate through cargo:

    $ cargo install bobbot   
    
  2. Create a Postgres role and database for Bob Bot:

    CREATE USER bobbot;
    CREATE DATABASE bobbot OWNER bobbot;
    
  3. Set the following environment variables, or create a .env file in the directory where you will execute the bot from:

    # Sets the logging level
    # https://docs.rs/env_logger/0.9.0/env_logger/
    export RUST_LOG=bobbot=info
    # Discord bot account token
    # https://discord.com/developers/applications/APPLICATION_ID/bot
    export DISCORD_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAA.AAAAAA.AAAAAAAAAAAAAAAAAAAAAAAAAAA
    # Discord application id
    # https://discord.com/developers/applications/APPLICATION_ID/information
    export DISCORD_APPID=000000000000000000
    # URL of the Postgres database
    # https://diesel.rs/guides/getting-started#setup-diesel-for-your-project
    export DATABASE_URL=postgres://bobbot@/bobbot
    

Running

  1. The first time you will run the bot, you'll need to register its slash commands so users can call them.
    You can do so by running the bot once with the following environment variable set:

    $ DISCORD_REGISTER_COMMANDS=1 bobbot
    
  2. The next times you will run the bot, do so without the environment variable, or all commands will not work for up to an hour:

    $ bobbot
    

Updating

  1. You can update the bot by re-installing the crate with cargo:

    $ cargo install bobbot
    
  2. If the slash commands have changed, you might need to re-register the slash commands at the first run:

    $ DISCORD_REGISTER_COMMANDS=1 bobbot
    

Development

The project was developed using IntelliJ IDEA Ultimate with the IntelliJ Rust plugin, and includes some useful things to make debug easier.

Dependencies

~25–40MB
~745K SLoC