Restrict bots from creating servers, groups, acking messages, and making friends.

This commit is contained in:
Paul
2021-08-11 20:16:11 +01:00
parent 084d71f050
commit 93610ebbc3
16 changed files with 65 additions and 5 deletions

View File

@@ -7,6 +7,10 @@ use mongodb::options::UpdateOptions;
#[put("/<target>/ack/<message>")]
pub async fn req(user: User, target: Ref, message: Ref) -> Result<()> {
if user.bot.is_some() {
return Err(Error::IsBot)
}
let target = target.fetch_channel().await?;
let perm = permissions::PermissionCalculator::new(&user)

View File

@@ -24,6 +24,10 @@ pub struct Data {
#[post("/create", data = "<info>")]
pub async fn req(user: User, info: Json<Data>) -> Result<Value> {
if user.bot.is_some() {
return Err(Error::IsBot)
}
let info = info.into_inner();
info.validate()
.map_err(|error| Error::FailedValidation { error })?;