fix: sub-validate message structs

This commit is contained in:
Paul Makles
2022-06-08 14:11:24 +01:00
parent 3de7ee4c7b
commit aaceb5bdee
2 changed files with 8 additions and 0 deletions

View File

@@ -71,6 +71,10 @@ pub async fn req(
new_embeds.clear();
for embed in embeds {
embed
.validate()
.map_err(|error| Error::FailedValidation { error })?;
new_embeds.push(embed.clone().into_embed(db, message.id.clone()).await?);
}
}

View File

@@ -164,6 +164,10 @@ pub async fn message_send(
let mut embeds = vec![];
if let Some(sendable_embeds) = data.embeds {
for sendable_embed in sendable_embeds {
sendable_embed
.validate()
.map_err(|error| Error::FailedValidation { error })?;
embeds.push(sendable_embed.into_embed(db, message_id.clone()).await?)
}
}