Restrict accounts to min 30 days to be able to call and start working on masks
This commit is contained in:
@@ -2,12 +2,16 @@ use std::{error::Error, sync::Arc};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use itertools::Itertools;
|
||||
use time::{Duration, UtcDateTime};
|
||||
use twilight_http::{api_error::ApiError, error::ErrorType};
|
||||
use twilight_model::{
|
||||
gateway::payload::incoming::{MessageCreate, MessageDelete, MessageUpdate},
|
||||
id::Id,
|
||||
};
|
||||
use twilight_util::builder::embed::{EmbedAuthorBuilder, EmbedBuilder, ImageSource};
|
||||
use twilight_util::{
|
||||
builder::embed::{EmbedAuthorBuilder, EmbedBuilder, ImageSource},
|
||||
snowflake::Snowflake,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
constants::COLOR_WHITE,
|
||||
@@ -15,14 +19,18 @@ use crate::{
|
||||
discord::sanitizing::SanitizeDiscordMarkdown,
|
||||
extras::Extras,
|
||||
framework::{
|
||||
commands::extras::ExtrasGetter, events::traits::{
|
||||
commands::{extras::ExtrasGetter, permissions::Permission},
|
||||
events::traits::{
|
||||
EventResult, OnMessageDeleteHandler, OnMessageEditHandler, OnMessageHandler,
|
||||
}, interactions::components::ActionRow, runtime::Runtime
|
||||
},
|
||||
interactions::components::ActionRow,
|
||||
runtime::Runtime,
|
||||
},
|
||||
groups::calls::{
|
||||
components::{CodeOfConductButton, NeedHelpButton},
|
||||
embeds, get_display_profile,
|
||||
moderation::{escape_message, Action, Rule},
|
||||
moderation::{Action, Rule, escape_message},
|
||||
permissions::NonNewAccountPermission,
|
||||
},
|
||||
state::State,
|
||||
utils::{ellipse, i64_to_u64},
|
||||
@@ -96,6 +104,12 @@ impl OnMessageHandler<State, Extras> for CallMessageHandler {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if UtcDateTime::from_unix_timestamp(event.author.id.timestamp() / 1000).unwrap()
|
||||
> UtcDateTime::now() - Duration::days(30)
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let prefixes = rt
|
||||
.get_prefixes(event.guild_id.map(|i| i.get()), Some(event.author.id.get()))
|
||||
.await;
|
||||
@@ -239,7 +253,11 @@ impl OnMessageHandler<State, Extras> for CallMessageHandler {
|
||||
embeds.push(
|
||||
EmbedBuilder::new()
|
||||
.author(
|
||||
EmbedAuthorBuilder::new(format!("Replying to {}", replying_to.data.author_name)).icon_url(
|
||||
EmbedAuthorBuilder::new(format!(
|
||||
"Replying to {}",
|
||||
replying_to.data.author_name
|
||||
))
|
||||
.icon_url(
|
||||
ImageSource::url(replying_to.data.author_avatar_url).unwrap(),
|
||||
),
|
||||
)
|
||||
@@ -323,6 +341,10 @@ impl OnMessageEditHandler<State, Extras> for CallMessageEditHandler {
|
||||
event: &MessageUpdate,
|
||||
rt: Arc<Runtime<State, Extras>>,
|
||||
) -> EventResult {
|
||||
if event.edited_timestamp.is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
log::trace!(
|
||||
"Edited message was '{}' sent by {} (bot? {:?})",
|
||||
event.content,
|
||||
|
||||
Reference in New Issue
Block a user