Fix some linting warningss
This commit is contained in:
+3
-52
@@ -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<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 {
|
||||
@@ -1098,23 +1081,6 @@ impl Call {
|
||||
|
||||
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)]
|
||||
@@ -1403,20 +1369,6 @@ impl Message {
|
||||
|
||||
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 {
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user