File tree Expand file tree Collapse file tree
rustmail/src/utils/message Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -587,6 +587,48 @@ impl<'a> MessageBuilder<'a> {
587587 eprintln ! ( "Failed to send message: {}" , e) ;
588588 }
589589 }
590+
591+ pub async fn send_interaction_followup (
592+ self ,
593+ command : & CommandInteraction ,
594+ to_be_recorded : bool ,
595+ ) -> Result < Message , ModmailError > {
596+ let pool = match & self . config . db_pool {
597+ Some ( pool) => pool,
598+ None => {
599+ return Err ( ModmailError :: Database ( DatabaseError :: ConnectionFailed ) ) ;
600+ }
601+ } ;
602+
603+ let response = self . build_interaction_message_followup ( ) . await ;
604+
605+ let message = command
606+ . create_followup ( & self . ctx . http , response)
607+ . await
608+ . map_err ( ModmailError :: from) ?;
609+
610+ if to_be_recorded {
611+ let thread_id = get_thread_by_channel_id ( & command. channel_id . to_string ( ) , pool)
612+ . await
613+ . map ( |t| t. id )
614+ . unwrap_or_default ( ) ;
615+
616+ let _ = insert_staff_message (
617+ self . ctx ,
618+ & message,
619+ None ,
620+ & thread_id,
621+ self . bot_user_id ,
622+ false ,
623+ pool,
624+ self . config ,
625+ None ,
626+ )
627+ . await ;
628+ }
629+
630+ Ok ( message)
631+ }
590632}
591633
592634impl < ' a > MessageBuilder < ' a > {
You can’t perform that action at this time.
0 commit comments