feat: reintroduce permission checks for send

This commit is contained in:
Paul Makles
2023-06-03 14:00:17 +01:00
parent 23188032ca
commit a0002d0b43
10 changed files with 82 additions and 57 deletions

View File

@@ -18,7 +18,7 @@ use crate::{
tasks::ack::AckEvent,
types::{
january::{Embed, Text},
push::{PushNotification, MessageAuthor},
push::{MessageAuthor, PushNotification},
},
Database, Error, Permission, Result,
};
@@ -170,20 +170,15 @@ impl Message {
}
/// Validate the sum of content of a message is under threshold
pub fn validate_sum(
content: &Option<String>,
embeds: &Option<Vec<SendableEmbed>>,
) -> Result<()> {
pub fn validate_sum(content: &Option<String>, embeds: &Vec<SendableEmbed>) -> Result<()> {
let mut running_total = 0;
if let Some(content) = content {
running_total += content.len();
}
if let Some(embeds) = embeds {
for embed in embeds {
if let Some(desc) = &embed.description {
running_total += desc.len();
}
for embed in embeds {
if let Some(desc) = &embed.description {
running_total += desc.len();
}
}