feat(messaging): cap total text content to 2k characters

This commit is contained in:
Paul Makles
2022-06-20 11:09:14 +01:00
parent 7fc4fb2df7
commit 4baab5d5d5
4 changed files with 33 additions and 0 deletions

View File

@@ -33,6 +33,8 @@ pub struct DataMessageSend {
/// Messages to reply to
replies: Option<Vec<Reply>>,
/// Embeds to include in message
///
/// Text embed content contributes to the content length cap
#[validate(length(min = 1, max = 10))]
embeds: Option<Vec<SendableEmbed>>,
/// Masquerade to apply to this message
@@ -61,6 +63,8 @@ pub async fn message_send(
data.validate()
.map_err(|error| Error::FailedValidation { error })?;
Message::validate_sum(&data.content, &data.embeds)?;
idempotency.consume_nonce(data.nonce).await?;
let channel = target.as_channel(db).await?;