From 830ac6cb61be2125208832e167a2ae148cb54d59 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Mon, 25 Apr 2022 11:40:04 -0700 Subject: [PATCH] cargo fmt --- src/commands/challenge.rs | 66 +++++++++++++++++++++++---------------- src/commands/owner.rs | 8 ++--- src/main.rs | 5 ++- 3 files changed, 46 insertions(+), 33 deletions(-) diff --git a/src/commands/challenge.rs b/src/commands/challenge.rs index 5680667..fef8f13 100644 --- a/src/commands/challenge.rs +++ b/src/commands/challenge.rs @@ -343,34 +343,46 @@ async fn suggest(ctx: &Context, msg: &Message, args: Args) -> CommandResult { ); // User::accent_colour is only available via the REST API // If we just do msg.author.accent_colour here, we will get None - let accent_color = ctx.http + let accent_color = ctx + .http .get_user(*msg.author.id.as_u64()) - .await.unwrap() + .await + .unwrap() .accent_colour; - channel.send_message(&ctx.http, |m| { - m.allowed_mentions(|am| { - am.empty_parse(); - am - }); - m.embed(|e| { - let username = format!("{}#{}", msg.author.name, msg.author.discriminator); - e.title("New suggestion"); - e.description(format!("{}\n\n[See original message]({}) ({})", args.rest(), msg.link(), msg.guild(&ctx).unwrap().name)); - let mut author = serenity::builder::CreateEmbedAuthor::default(); - author - .icon_url(format!("https://cdn.discordapp.com/avatars/{}/{}.webp", msg.author.id, msg.author.avatar.as_ref().unwrap())) - .name(username) - .url(format!("https://discord.com/users/{}", msg.author.id)); - e.set_author(author); - if let Some(accent_color) = accent_color { - e.color(accent_color); - } - e - }); - m - }) - .await - .unwrap(); + channel + .send_message(&ctx.http, |m| { + m.allowed_mentions(|am| { + am.empty_parse(); + am + }); + m.embed(|e| { + let username = format!("{}#{}", msg.author.name, msg.author.discriminator); + e.title("New suggestion"); + e.description(format!( + "{}\n\n[See original message]({}) ({})", + args.rest(), + msg.link(), + msg.guild(&ctx).unwrap().name + )); + let mut author = serenity::builder::CreateEmbedAuthor::default(); + author + .icon_url(format!( + "https://cdn.discordapp.com/avatars/{}/{}.webp", + msg.author.id, + msg.author.avatar.as_ref().unwrap() + )) + .name(username) + .url(format!("https://discord.com/users/{}", msg.author.id)); + e.set_author(author); + if let Some(accent_color) = accent_color { + e.color(accent_color); + } + e + }); + m + }) + .await + .unwrap(); msg.reply(&ctx.http, "Suggestion sent! Thank you for making a suggestion. If it is chosen to be used in a future challenge, you will be mentioned in the challenge description!").await?; Ok(()) -} \ No newline at end of file +} diff --git a/src/commands/owner.rs b/src/commands/owner.rs index 7ec05e7..2565237 100644 --- a/src/commands/owner.rs +++ b/src/commands/owner.rs @@ -67,11 +67,9 @@ async fn setSuggestionChannel(ctx: &Context, msg: &Message) -> CommandResult { set_guild_data(guild_data); msg.reply( &ctx.http, - format!( - "Submission channel set to <#{}>.", - msg.channel_id - ), - ).await?; + format!("Submission channel set to <#{}>.", msg.channel_id), + ) + .await?; Ok(()) } diff --git a/src/main.rs b/src/main.rs index 45411a1..c6f3656 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,10 @@ use serenity::{ client::bridge::gateway::ShardManager, framework::{standard::macros::group, StandardFramework}, http::Http, - model::{event::ResumedEvent, gateway::{Ready, GatewayIntents}}, + model::{ + event::ResumedEvent, + gateway::{GatewayIntents, Ready}, + }, prelude::*, }; use tracing::{error, info};