26a0728e14
The root README carried the full ten cog manual while the wiki held the authoritative pages. Point the repository at the wiki, keep only install and catalog basics in the README, and remove the per cog documents that are now folded into wiki source under wiki/.
153 lines
6.7 KiB
Markdown
153 lines
6.7 KiB
Markdown
# AutoRoom Overview
|
|
|
|
AutoRoom creates a temporary voice channel for a member who joins a designated source channel, gives that member control of the new channel, and deletes it when the last person leaves.
|
|
|
|
The cog is PhasecoreX's AutoRoom version 4.0.7 with local modifications. Its command names, aliases and general design follow that upstream project. The notes below describe the code in this repository.
|
|
|
|
## Concepts
|
|
|
|
| Term | Meaning |
|
|
|---|---|
|
|
| AutoRoom Source | A voice channel marked as a source. Joining it creates a room |
|
|
| AutoRoom | The temporary voice channel created for a member |
|
|
| AutoRoom Owner | The member who owns the room, normally the member who triggered creation |
|
|
| Member roles | The roles allowed to connect to a source, which decide who can use it |
|
|
| Destination category | The category new rooms are created in |
|
|
|
|
A guild can have several sources, each with its own category, room type, name format and text settings.
|
|
|
|
## Requirements
|
|
|
|
- Manage Channels, Manage Roles, Move Members, View Channel, Connect and Send Messages in the relevant channels.
|
|
- A voice channel to use as the source and a category for the new rooms.
|
|
- `func-timeout` and `jinja2` from the manifest.
|
|
|
|
`[p]autoroomset permissions` checks the bot's permissions against a source and reports what is missing.
|
|
|
|
## Setup
|
|
|
|
```
|
|
[p]autoroomset create <source voice channel> <destination category>
|
|
```
|
|
|
|
The command walks through the setup with prompts, offering to create a source, choose a room type, and set a name format. It warns when permissions are missing. After setup, join the source to confirm a room is created and you are moved into it.
|
|
|
|
Further changes are made with `[p]autoroomset modify`, which has subcommands for the category, room type, name format, text channel behaviour and defaults. `[p]autoroomset settings` shows the current server and source configuration.
|
|
|
|
## Room types
|
|
|
|
A room's type is stored per source and can be changed per room by its owner.
|
|
|
|
| Type | Behavior |
|
|
|---|---|
|
|
| Public | Everyone who can see the category can see and join |
|
|
| Locked | Everyone who can see the category can see the room, nobody can join unless allowed |
|
|
| Private | Nobody can see or join unless allowed |
|
|
|
|
`[p]autoroom public`, `locked` and `private` switch between these. `[p]autoroom allow` and `deny` add member or role overwrites that survive type changes.
|
|
|
|
## Member roles
|
|
|
|
Member roles are not a stored list. They are derived from the source channel's permission overwrites: a role counts as a member role when it is allowed to connect to the source while `@everyone` is denied connect. This behaviour comes from schema migration 6, which removed the old stored `member_role` setting.
|
|
|
|
Two consequences:
|
|
|
|
- Roles can be changed without a command, by editing the source channel's permissions in Discord.
|
|
- A source that allows `@everyone` to connect has no member roles, and every member can create rooms from it.
|
|
|
|
Denying roles in a room that uses member roles can produce unexpected results, because allowed member roles may grant access back.
|
|
|
|
## Creating and deleting rooms
|
|
|
|
1. A member joins a source channel.
|
|
2. The cog checks the member's create cooldown: two creations per 60 seconds per member. A warning is shown at most once per hour.
|
|
3. A new voice channel is created in the source's destination category, named from the configured template.
|
|
4. The member is moved into it and becomes the owner. The owner gets the permissions configured for owners, which by default include managing the channel, moving members and managing messages in the linked text channel.
|
|
5. When the last member leaves, the channel is deleted. A channel with a bot inside stays alive, and so does one with a member who cannot be moved.
|
|
|
|
An owner who leaves and returns keeps ownership while the room exists. `[p]autoroom claim` transfers ownership when the owner has left, subject to a two minute cooldown per channel and the server access rules.
|
|
|
|
## Deletion and cleanup
|
|
|
|
Rooms are deleted when the last member leaves. A bot that remains in the channel counts as a member, so it keeps the room alive.
|
|
|
|
On load, a cleanup task walks every stored room record and deletes the record when the channel no longer exists in Discord. This clears entries after a room was deleted by hand or lost to a reset. The task does not delete live channels.
|
|
|
|
## Server access overrides
|
|
|
|
`[p]autoroomset access` controls who can enter rooms regardless of the room's type.
|
|
|
|
| Setting | Default | Command |
|
|
|---|---|---|
|
|
| Admin access to all rooms | On | `[p]autoroomset access admin` |
|
|
| Moderator access to all rooms | Off | `[p]autoroomset access mod` |
|
|
| Bot roles allowed in all rooms | Empty | `[p]autoroomset access bot add` and `remove` |
|
|
|
|
Admin and moderator access uses Red's role definitions, so a server's configured admin and mod roles apply.
|
|
|
|
## AutoRoom Source permissions
|
|
|
|
The bot needs these on a source:
|
|
|
|
- View Channel
|
|
- Connect
|
|
- Move Members
|
|
|
|
On the destination category it needs:
|
|
|
|
- View Channel
|
|
- Connect
|
|
- Send Messages
|
|
- Manage Channels
|
|
- Manage Messages
|
|
- Move Members
|
|
|
|
`[p]autoroomset permissions` performs the check and reports missing entries.
|
|
|
|
## Limits
|
|
|
|
- Channel names are capped at 100 characters by the cog, and Discord enforces its own limit.
|
|
- Owners can rename through the `name` command twice per roughly ten minutes per channel, with a four second allowance for Discord's own rename. The error message suggests renaming the channel directly in Discord instead.
|
|
- Bitrate is clamped between 8 kbps and the guild's boost dependent limit.
|
|
- User limit is clamped between 0 and 99, where 0 means no limit.
|
|
- Room state lives in Discord channels plus config. Deleting a room's channel manually leaves its config entry until the next cleanup, which clears missing channels.
|
|
|
|
## Stored data
|
|
|
|
Global config under identifier `1224364860` holds `schema_version`.
|
|
|
|
Guild config:
|
|
|
|
| Key | Default |
|
|
|---|---|
|
|
| `admin_access` | `true` |
|
|
| `mod_access` | `false` |
|
|
| `bot_access` | `[]` |
|
|
|
|
Custom group `AUTOROOM_SOURCE`, keyed by guild and source channel:
|
|
|
|
| Key | Default |
|
|
|---|---|
|
|
| `dest_category_id` | `null` |
|
|
| `room_type` | `public` |
|
|
| `legacy_text_channel` | `false` |
|
|
| `text_channel_hint` | `null` |
|
|
| `text_channel_topic` | empty |
|
|
| `channel_name_type` | `username` |
|
|
| `channel_name_format` | empty |
|
|
| `perm_owner_manage_channels` | `true` |
|
|
| `perm_send_messages` | `true` |
|
|
|
|
Channel config for each created room:
|
|
|
|
| Key | Meaning |
|
|
|---|---|
|
|
| `source_channel` | ID of the source that created it |
|
|
| `owner` | Member ID of the owner, or null |
|
|
| `associated_text_channel` | ID of the linked text channel, when applicable |
|
|
| `denied` | Stored deny list |
|
|
|
|
`red_delete_data_for_user` does nothing, so deleting a user's data does not remove ownership records from their rooms.
|
|
|
|
Next: [AutoRoom Commands](AutoRoom-Commands) and [AutoRoom Templates](AutoRoom-Templates).
|