Fix some linting warningss

This commit is contained in:
2026-04-03 06:01:48 -03:00
parent 53e066f868
commit 6248dc72f0
3 changed files with 4 additions and 54 deletions
+3 -52
View File
@@ -18,7 +18,7 @@ use twilight_model::channel::{Message as TwilightMessage, Webhook};
use twilight_model::guild::Guild as TwilightGuild; use twilight_model::guild::Guild as TwilightGuild;
use twilight_model::id::Id; use twilight_model::id::Id;
use twilight_model::user::User as TwilightUser; 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::colors::AvatarColorFetchingRequest;
use crate::constants::DEFAULT_PREFIX; use crate::constants::DEFAULT_PREFIX;
@@ -345,23 +345,6 @@ impl User {
is_first_incident: incidents.is_empty(), is_first_incident: incidents.is_empty(),
}) })
} }
pub async fn count(session: &Session) -> Result<usize, DatabaseError> {
let result = session
.query_unpaged(
r#"
SELECT
user_id
FROM
payphone.users;
"#,
(),
)
.await?
.into_rows_result()?;
Ok(result.rows_num())
}
} }
impl From<TwilightUser> for User { impl From<TwilightUser> for User {
@@ -1098,23 +1081,6 @@ impl Call {
Ok(()) Ok(())
} }
pub async fn count(session: &Session) -> Result<usize, DatabaseError> {
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)] #[derive(Debug, Clone, SerializeValue, DeserializeValue)]
@@ -1403,20 +1369,6 @@ impl Message {
Ok(()) Ok(())
} }
pub async fn count(session: &Session) -> Result<usize, DatabaseError> {
let result = session
.query_unpaged(
r#"
SELECT message_id FROM payphone.messages;
"#,
(),
)
.await?
.into_rows_result()?;
Ok(result.rows_num())
}
} }
pub struct MessageByAuthorId { pub struct MessageByAuthorId {
@@ -1840,8 +1792,8 @@ impl<'a> Object<'a> for Participant {
} }
fn make_name_valid(mut name: String) -> String { fn make_name_valid(mut name: String) -> String {
if let Err(error) = webhook_username(&name) { if let Err(error) = webhook_username(&name)
if let ValidationErrorType::WebhookUsername { len, .. } = error.kind() { && let ValidationErrorType::WebhookUsername { len, .. } = error.kind() {
if let Some(len) = len { if let Some(len) = len {
if *len < 2 { if *len < 2 {
name = format!("{name}--"); name = format!("{name}--");
@@ -1852,7 +1804,6 @@ fn make_name_valid(mut name: String) -> String {
name = "Invalid name".into(); name = "Invalid name".into();
} }
} }
}
name name
} }
-1
View File
@@ -2,7 +2,6 @@ use async_trait::async_trait;
use rand::{Rng, SeedableRng}; use rand::{Rng, SeedableRng};
use rand_chacha::ChaCha20Rng; use rand_chacha::ChaCha20Rng;
use twilight_model::gateway::payload::outgoing::UpdatePresence; 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 twilight_model::gateway::presence::{Activity, ActivityType, Status};
use crate::extras::Extras; use crate::extras::Extras;
+1 -1
View File
@@ -2,7 +2,7 @@ use async_trait::async_trait;
use time::{Duration, UtcDateTime}; use time::{Duration, UtcDateTime};
use twilight_util::snowflake::Snowflake; 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::extras::Extras;
use crate::framework::commands::CommandError; use crate::framework::commands::CommandError;
use crate::framework::commands::context::CommandContext; use crate::framework::commands::context::CommandContext;