Restrict bots from creating servers, groups, acking messages, and making friends.
This commit is contained in:
@@ -3,6 +3,10 @@ use crate::util::result::{Error, Result};
|
||||
|
||||
#[put("/<target>/ack")]
|
||||
pub async fn req(user: User, target: Ref) -> Result<()> {
|
||||
if user.bot.is_some() {
|
||||
return Err(Error::IsBot)
|
||||
}
|
||||
|
||||
let target = target.fetch_server().await?;
|
||||
|
||||
let perm = permissions::PermissionCalculator::new(&user)
|
||||
|
||||
@@ -22,6 +22,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 })?;
|
||||
|
||||
Reference in New Issue
Block a user