@@ -284,6 +284,7 @@ pub async fn create_game_suggestion(
284284 let author_id = ctx. author ( ) . id ;
285285 let game_name = game_response. game . name . clone ( ) ;
286286 let platform = game_response. platform . name . clone ( ) ;
287+ let company = game_response. company . clone ( ) . map ( |c| c. name ) ;
287288 async move {
288289 handle_suggestion_message ( SuggestionMessageHandleData {
289290 playmatch_client,
@@ -296,6 +297,8 @@ pub async fn create_game_suggestion(
296297 r#type : SuggestionType :: Game ,
297298 name : game_name,
298299 platform : Some ( platform) ,
300+ company,
301+ comment : suggestion. comment ,
299302 } )
300303 . await
301304 }
@@ -376,6 +379,8 @@ pub async fn create_company_suggestion(
376379 r#type : SuggestionType :: Company ,
377380 name : company_name,
378381 platform : None ,
382+ company : None ,
383+ comment : suggestion. comment ,
379384 } )
380385 . await
381386 }
@@ -437,6 +442,16 @@ pub async fn create_platform_suggestion(
437442 }
438443 } ;
439444
445+ let platform_id = suggestion. platform_id . ok_or_else ( || {
446+ anyhow ! ( "Platform ID is missing in the suggestion response! This should not happen." )
447+ } ) ?;
448+
449+ let platform = ctx
450+ . data ( )
451+ . playmatch_client
452+ . get_platform_by_id ( & platform_id)
453+ . await ?;
454+
440455 tokio:: spawn ( {
441456 let playmatch_client = ctx. data ( ) . playmatch_client . clone ( ) ;
442457 let http = ctx. serenity_context ( ) . http . clone ( ) ;
@@ -445,6 +460,7 @@ pub async fn create_platform_suggestion(
445460 let owners = ctx. framework ( ) . options ( ) . owners . clone ( ) ;
446461 let author_id = ctx. author ( ) . id ;
447462 let platform_name = name. clone ( ) ;
463+ let company = platform. company_name . clone ( ) ;
448464 async move {
449465 handle_suggestion_message ( SuggestionMessageHandleData {
450466 playmatch_client,
@@ -457,6 +473,8 @@ pub async fn create_platform_suggestion(
457473 r#type : SuggestionType :: Platform ,
458474 name : platform_name,
459475 platform : None ,
476+ company,
477+ comment : suggestion. comment ,
460478 } )
461479 . await
462480 }
@@ -657,6 +675,8 @@ struct SuggestionMessageHandleData {
657675 r#type : SuggestionType ,
658676 name : String ,
659677 platform : Option < String > ,
678+ company : Option < String > ,
679+ comment : Option < String > ,
660680}
661681
662682async fn handle_suggestion_message ( data : SuggestionMessageHandleData ) -> CommandResult {
@@ -685,28 +705,36 @@ async fn handle_suggestion_message(data: SuggestionMessageHandleData) -> Command
685705 } ;
686706
687707 let mut embed = CreateEmbed :: new ( )
688- . title ( "📝 New Metadata Suggestion" )
689- . color ( 0x3498DB )
690- . field (
691- display_type. to_string ( ) ,
692- format ! ( "**{}**" , data. name) ,
693- false ,
694- )
708+ . title ( format ! ( "📝 New {} Metadata Suggestion" , display_type) )
709+ . color ( 0x3498DB ) ;
710+
711+ if let Some ( company) = & data. company {
712+ embed = embed. field ( "Company" , company, true ) ;
713+ }
714+
715+ if let Some ( platform) = & data. platform {
716+ embed = embed. field ( "Platform" , platform, true ) ;
717+ }
718+
719+ embed = embed
720+ . field ( display_type. to_string ( ) , format ! ( "**{}**" , data. name) , true )
695721 . field (
696722 "Suggested by" ,
697723 format ! ( "<@{}> ({})" , author. id, author. name) ,
698724 false ,
699725 )
700726 . field ( "Metadata Provider" , "IGDB" , true )
701727 . field ( "Provider ID" , format ! ( "`{}`" , suggestion. provider_id) , true )
728+ . field (
729+ "Comment" ,
730+ data. comment
731+ . unwrap_or_else ( || "No comment provided" . to_string ( ) ) ,
732+ false ,
733+ )
702734 . footer ( CreateEmbedFooter :: new (
703735 "Use the buttons below to approve or decline this suggestion." ,
704736 ) ) ;
705737
706- if let Some ( platform) = & data. platform {
707- embed = embed. field ( "Platform" , platform, true ) ;
708- }
709-
710738 let message = channel
711739 . send_message (
712740 & data. http ,
0 commit comments