diff --git a/src/database/models.rs b/src/database/models.rs index c85fee1..a955bbc 100644 --- a/src/database/models.rs +++ b/src/database/models.rs @@ -18,7 +18,7 @@ use twilight_model::channel::{Message as TwilightMessage, Webhook}; use twilight_model::guild::Guild as TwilightGuild; use twilight_model::id::Id; use twilight_model::user::User as TwilightUser; -use twilight_validate::request::{ValidationError, ValidationErrorType, webhook_username}; +use twilight_validate::request::{ValidationErrorType, webhook_username}; use crate::colors::AvatarColorFetchingRequest; use crate::constants::DEFAULT_PREFIX; @@ -345,23 +345,6 @@ impl User { is_first_incident: incidents.is_empty(), }) } - - pub async fn count(session: &Session) -> Result { - let result = session - .query_unpaged( - r#" - SELECT - user_id - FROM - payphone.users; - "#, - (), - ) - .await? - .into_rows_result()?; - - Ok(result.rows_num()) - } } impl From for User { @@ -1098,23 +1081,6 @@ impl Call { Ok(()) } - - pub async fn count(session: &Session) -> Result { - let result = session - .query_unpaged( - r#" - SELECT - call_id - FROM - payphone.calls; - "#, - (), - ) - .await? - .into_rows_result()?; - - Ok(result.rows_num()) - } } #[derive(Debug, Clone, SerializeValue, DeserializeValue)] @@ -1403,20 +1369,6 @@ impl Message { Ok(()) } - - pub async fn count(session: &Session) -> Result { - let result = session - .query_unpaged( - r#" - SELECT message_id FROM payphone.messages; - "#, - (), - ) - .await? - .into_rows_result()?; - - Ok(result.rows_num()) - } } pub struct MessageByAuthorId { @@ -1840,8 +1792,8 @@ impl<'a> Object<'a> for Participant { } fn make_name_valid(mut name: String) -> String { - if let Err(error) = webhook_username(&name) { - if let ValidationErrorType::WebhookUsername { len, .. } = error.kind() { + if let Err(error) = webhook_username(&name) + && let ValidationErrorType::WebhookUsername { len, .. } = error.kind() { if let Some(len) = len { if *len < 2 { name = format!("{name}--"); @@ -1852,7 +1804,6 @@ fn make_name_valid(mut name: String) -> String { name = "Invalid name".into(); } } - } name } diff --git a/src/groups/about/tasks.rs b/src/groups/about/tasks.rs index 8b24bcb..64cbae7 100644 --- a/src/groups/about/tasks.rs +++ b/src/groups/about/tasks.rs @@ -2,7 +2,6 @@ use async_trait::async_trait; use rand::{Rng, SeedableRng}; use rand_chacha::ChaCha20Rng; use twilight_model::gateway::payload::outgoing::UpdatePresence; -use twilight_model::gateway::payload::outgoing::update_presence::UpdatePresencePayload; use twilight_model::gateway::presence::{Activity, ActivityType, Status}; use crate::extras::Extras; diff --git a/src/groups/calls/permissions.rs b/src/groups/calls/permissions.rs index c9f2788..947d16d 100644 --- a/src/groups/calls/permissions.rs +++ b/src/groups/calls/permissions.rs @@ -2,7 +2,7 @@ use async_trait::async_trait; use time::{Duration, UtcDateTime}; use twilight_util::snowflake::Snowflake; -use crate::database::models::{Call, Channel, Participant, UserIncident}; +use crate::database::models::{Channel, Participant, UserIncident}; use crate::extras::Extras; use crate::framework::commands::CommandError; use crate::framework::commands::context::CommandContext;