fmt: fmt and clippy

This commit is contained in:
silver 2024-09-17 22:11:34 +01:00
parent 11240914ac
commit f3ef03a418
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
3 changed files with 49 additions and 54 deletions

View file

@ -51,30 +51,28 @@ pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> Stri
}
};
let bot_channel_id = if let CommandDataOptionValue::Channel(channel) = command
.data
.options
.get(3)
.expect("Expected channel option")
.resolved
.as_ref()
.expect("Expected channel object")
.data
.options
.get(3)
.expect("Expected channel option")
.resolved
.as_ref()
.expect("Expected channel object")
{
channel.id.to_owned()
} else {
return "Please provide a valid channel for ``Bot Channel``".to_string();
};
let server_name = if let CommandDataOptionValue::String(name) = command
.data
.options
.get(4)
.expect("Expected Server Name option")
.resolved
.as_ref()
.expect("Expected Server Name object")
.data
.options
.get(4)
.expect("Expected Server Name option")
.resolved
.as_ref()
.expect("Expected Server Name object")
{
name
} else {
@ -82,13 +80,13 @@ pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> Stri
};
let wolves_link = if let CommandDataOptionValue::String(wolves) = command
.data
.options
.get(5)
.expect("Expected Wolves Link option")
.resolved
.as_ref()
.expect("Expected Server Name object")
.data
.options
.get(5)
.expect("Expected Wolves Link option")
.resolved
.as_ref()
.expect("Expected Server Name object")
{
wolves
} else {
@ -149,27 +147,27 @@ pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicatio
.kind(CommandOptionType::Role)
.required(false)
})
.create_option(|option| {
option
.name("bot_channel")
.description("Safe space for folks to use the bot commands.")
.kind(CommandOptionType::Channel)
.required(true)
})
.create_option(|option| {
option
.name("server_name")
.description("Name of the Discord Server.")
.kind(CommandOptionType::String)
.required(true)
})
.create_option(|option| {
option
.name("wolves_link")
.description("Link to the Club/Society on UL Wolves.")
.kind(CommandOptionType::String)
.required(true)
})
.create_option(|option| {
option
.name("bot_channel")
.description("Safe space for folks to use the bot commands.")
.kind(CommandOptionType::Channel)
.required(true)
})
.create_option(|option| {
option
.name("server_name")
.description("Name of the Discord Server.")
.kind(CommandOptionType::String)
.required(true)
})
.create_option(|option| {
option
.name("wolves_link")
.description("Link to the Club/Society on UL Wolves.")
.kind(CommandOptionType::String)
.required(true)
})
}
async fn add_server(db: &Pool<Sqlite>, ctx: &Context, server: &Servers) -> Result<Option<Servers>, Error> {