fmt: fmt and clippy

This commit is contained in:
silver 2024-08-31 19:21:58 +01:00
parent 44399fe277
commit 982814d99c
3 changed files with 29 additions and 26 deletions

View file

@ -16,11 +16,10 @@ use serenity::{
use skynet_discord_bot::{random_string, Config, DataBase};
use sqlx::{Pool, Sqlite};
pub mod link {
use super::*;
use serenity::model::id::GuildId;
use skynet_discord_bot::Committee;
use super::*;
pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> String {
let committee_server = GuildId(1220150752656363520);
@ -35,7 +34,6 @@ pub mod link {
}
}
let option = command
.data
.options
@ -56,7 +54,6 @@ pub mod link {
return "Please use a @ulwolves.ie address you have access to.".to_string();
}
let db_lock = {
let data_read = ctx.data.read().await;
data_read.get::<DataBase>().expect("Expected Databse in TypeMap.").clone()
@ -77,7 +74,6 @@ pub mod link {
return "Linking already in process, please check email.".to_string();
}
// generate a auth key
let auth = random_string(20);
match send_mail(&config, email, &auth, &command.user.name) {
@ -99,7 +95,13 @@ pub mod link {
command
.name("link_committee")
.description("Verify you are a committee member")
.create_option(|option| option.name("email").description("UL Wolves Committee Email").kind(CommandOptionType::String).required(true))
.create_option(|option| {
option
.name("email")
.description("UL Wolves Committee Email")
.kind(CommandOptionType::String)
.required(true)
})
}
pub async fn get_server_member_discord(db: &Pool<Sqlite>, user: &UserId) -> Option<Committee> {
@ -206,11 +208,11 @@ pub mod link {
}
pub mod verify {
use serenity::model::id::{GuildId, RoleId};
use super::*;
use crate::commands::committee::link::{get_verify_from_db};
use crate::commands::committee::link::get_verify_from_db;
use serenity::model::id::{GuildId, RoleId};
use serenity::model::user::User;
use skynet_discord_bot::{Committee};
use skynet_discord_bot::Committee;
use sqlx::Error;
pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> String {
@ -272,7 +274,10 @@ pub mod verify {
}
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
command.name("verify_committee").description("Verify Wolves Committee Email").create_option(|option| {
command
.name("verify_committee")
.description("Verify Wolves Committee Email")
.create_option(|option| {
option
.name("code")
.description("Code from verification email")
@ -303,5 +308,4 @@ pub mod verify {
}
}
}
}

View file

@ -1,4 +1,4 @@
pub mod add_server;
pub mod committee;
pub mod link_email;
pub mod minecraft;
pub mod committee;

View file

@ -218,7 +218,6 @@ impl<'r> FromRow<'r, SqliteRow> for WolvesVerify {
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Committee {
pub email: String,