@ -343,34 +343,46 @@ async fn suggest(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
) ;
) ;
// User::accent_colour is only available via the REST API
// User::accent_colour is only available via the REST API
// If we just do msg.author.accent_colour here, we will get None
// 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 ( ) )
. get_user ( * msg . author . id . as_u64 ( ) )
. await . unwrap ( )
. await
. unwrap ( )
. accent_colour ;
. accent_colour ;
channel . send_message ( & ctx . http , | m | {
channel
m . allowed_mentions ( | am | {
. send_message ( & ctx . http , | m | {
am . empty_parse ( ) ;
m . allowed_mentions ( | am | {
am
am . empty_parse ( ) ;
} ) ;
am
m . embed ( | e | {
} ) ;
let username = format! ( "{}#{}" , msg . author . name , msg . author . discriminator ) ;
m . embed ( | e | {
e . title ( "New suggestion" ) ;
let username = format! ( "{}#{}" , msg . author . name , msg . author . discriminator ) ;
e . description ( format! ( "{}\n\n[See original message]({}) ({})" , args . rest ( ) , msg . link ( ) , msg . guild ( & ctx ) . unwrap ( ) . name ) ) ;
e . title ( "New suggestion" ) ;
let mut author = serenity ::builder ::CreateEmbedAuthor ::default ( ) ;
e . description ( format! (
author
"{}\n\n[See original message]({}) ({})" ,
. icon_url ( format! ( "https://cdn.discordapp.com/avatars/{}/{}.webp" , msg . author . id , msg . author . avatar . as_ref ( ) . unwrap ( ) ) )
args . rest ( ) ,
. name ( username )
msg . link ( ) ,
. url ( format! ( "https://discord.com/users/{}" , msg . author . id ) ) ;
msg . guild ( & ctx ) . unwrap ( ) . name
e . set_author ( author ) ;
) ) ;
if let Some ( accent_color ) = accent_color {
let mut author = serenity ::builder ::CreateEmbedAuthor ::default ( ) ;
e . color ( accent_color ) ;
author
}
. icon_url ( format! (
e
"https://cdn.discordapp.com/avatars/{}/{}.webp" ,
} ) ;
msg . author . id ,
m
msg . author . avatar . as_ref ( ) . unwrap ( )
} )
) )
. await
. name ( username )
. unwrap ( ) ;
. 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 ? ;
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 ( ( ) )
Ok ( ( ) )
}
}