fmt: fmt and clippy
All checks were successful
On_Push / lint_fmt (push) Successful in 6s
On_Push / lint_clippy (push) Successful in 3m58s
On_Push / build (push) Successful in 1m46s
On_Push / deploy (push) Successful in 12s

This commit is contained in:
silver 2024-08-31 19:21:58 +01:00
parent 5c2502f726
commit 50d2923425
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
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 skynet_discord_bot::{random_string, Config, DataBase};
use sqlx::{Pool, Sqlite}; use sqlx::{Pool, Sqlite};
pub mod link { pub mod link {
use super::*;
use serenity::model::id::GuildId; use serenity::model::id::GuildId;
use skynet_discord_bot::Committee; use skynet_discord_bot::Committee;
use super::*;
pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> String { pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> String {
let committee_server = GuildId(1220150752656363520); let committee_server = GuildId(1220150752656363520);
@ -35,7 +34,6 @@ pub mod link {
} }
} }
let option = command let option = command
.data .data
.options .options
@ -56,7 +54,6 @@ pub mod link {
return "Please use a @ulwolves.ie address you have access to.".to_string(); return "Please use a @ulwolves.ie address you have access to.".to_string();
} }
let db_lock = { let db_lock = {
let data_read = ctx.data.read().await; let data_read = ctx.data.read().await;
data_read.get::<DataBase>().expect("Expected Databse in TypeMap.").clone() 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(); return "Linking already in process, please check email.".to_string();
} }
// generate a auth key // generate a auth key
let auth = random_string(20); let auth = random_string(20);
match send_mail(&config, email, &auth, &command.user.name) { match send_mail(&config, email, &auth, &command.user.name) {
@ -99,7 +95,13 @@ pub mod link {
command command
.name("link_committee") .name("link_committee")
.description("Verify you are a committee member") .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> { pub async fn get_server_member_discord(db: &Pool<Sqlite>, user: &UserId) -> Option<Committee> {
@ -206,11 +208,11 @@ pub mod link {
} }
pub mod verify { pub mod verify {
use serenity::model::id::{GuildId, RoleId};
use super::*; 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 serenity::model::user::User;
use skynet_discord_bot::{Committee}; use skynet_discord_bot::Committee;
use sqlx::Error; use sqlx::Error;
pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> String { pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> String {
@ -272,7 +274,10 @@ pub mod verify {
} }
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { 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 option
.name("code") .name("code")
.description("Code from verification email") .description("Code from verification email")
@ -303,5 +308,4 @@ pub mod verify {
} }
} }
} }
} }

View file

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

View file

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