feat: clean up bot restrictions

This commit is contained in:
Paul Makles
2022-05-07 15:20:42 +01:00
parent 97fef56bad
commit 09e918d8e0
15 changed files with 59 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
use revolt_quark::{
models::{Invite, User},
perms, Db, Permission, Ref, Result,
perms, Db, Error, Permission, Ref, Result,
};
use rocket::serde::json::Json;
@@ -13,6 +13,10 @@ use rocket::serde::json::Json;
#[openapi(tag = "Channel Invites")]
#[post("/<target>/invites")]
pub async fn req(db: &Db, user: User, target: Ref) -> Result<Json<Invite>> {
if user.bot.is_some() {
return Err(Error::IsBot);
}
let channel = target.as_channel(db).await?;
perms(&user)
.channel(&channel)