feat: Allow restricting server creation to specific users (#685)

Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com>
This commit is contained in:
Tom
2026-03-23 12:25:33 -07:00
committed by GitHub
parent cf2cedcee1
commit edfa97db10
7 changed files with 56 additions and 19 deletions

View File

@@ -1,3 +1,4 @@
use revolt_config::config;
use revolt_database::{Database, Member, Server, User};
use revolt_models::v0;
use revolt_result::{create_error, Result};
@@ -20,6 +21,24 @@ pub async fn create_server(
return Err(create_error!(IsBot));
}
let config = config().await;
if !config
.features
.limits
.global
.restrict_server_creation
.is_empty()
&& !config
.features
.limits
.global
.restrict_server_creation
.contains(&user.id)
{
return Err(create_error!(CantCreateServers));
}
let data = data.into_inner();
data.validate().map_err(|error| {
create_error!(FailedValidation {