@@ -91,7 +91,7 @@ pub async fn handle_edit(
9191 author : User ,
9292 mut old : Message ,
9393 original_message : Message ,
94- ) {
94+ ) -> serenity :: Result < ( ) > {
9595 let prefix = {
9696 let data = ctx. data . read ( ) . await ;
9797 let info = data. get :: < ConfigCache > ( ) . unwrap ( ) . read ( ) . await ;
@@ -122,8 +122,8 @@ pub async fn handle_edit(
122122 )
123123 . await
124124 {
125- let err = embeds:: build_fail_embed ( & author, & e. to_string ( ) ) ;
126- embeds:: edit_message_embed ( ctx, & mut old, err, None ) . await ;
125+ let mut err = embeds:: build_fail_embed ( & author, & e. to_string ( ) ) ;
126+ embeds:: edit_message_embed ( ctx, & mut old, & mut err, None ) . await ? ;
127127 }
128128 } else if content. starts_with ( & format ! ( "{}compile" , prefix) ) {
129129 if let Err ( e) = handle_edit_compile (
@@ -135,8 +135,8 @@ pub async fn handle_edit(
135135 )
136136 . await
137137 {
138- let err = embeds:: build_fail_embed ( & author, & e. to_string ( ) ) ;
139- embeds:: edit_message_embed ( ctx, & mut old, err, None ) . await ;
138+ let mut err = embeds:: build_fail_embed ( & author, & e. to_string ( ) ) ;
139+ embeds:: edit_message_embed ( ctx, & mut old, & mut err, None ) . await ? ;
140140 }
141141 } else if content. starts_with ( & format ! ( "{}cpp" , prefix) ) {
142142 if let Err ( e) = handle_edit_cpp (
@@ -148,8 +148,8 @@ pub async fn handle_edit(
148148 )
149149 . await
150150 {
151- let err = embeds:: build_fail_embed ( & author, & e. to_string ( ) ) ;
152- embeds:: edit_message_embed ( ctx, & mut old, err, None ) . await ;
151+ let mut err = embeds:: build_fail_embed ( & author, & e. to_string ( ) ) ;
152+ embeds:: edit_message_embed ( ctx, & mut old, & mut err, None ) . await ? ;
153153 }
154154 } else if content. starts_with ( & format ! ( "{}insights" , prefix) ) {
155155 if let Err ( e) = handle_edit_insights (
@@ -161,13 +161,15 @@ pub async fn handle_edit(
161161 )
162162 . await
163163 {
164- let err = embeds:: build_fail_embed ( & author, & e. to_string ( ) ) ;
165- embeds:: edit_message_embed ( ctx, & mut old, err, None ) . await ;
164+ let mut err = embeds:: build_fail_embed ( & author, & e. to_string ( ) ) ;
165+ embeds:: edit_message_embed ( ctx, & mut old, & mut err, None ) . await ? ;
166166 }
167167 } else {
168- let err = embeds:: build_fail_embed ( & author, "Invalid command for edit functionality!" ) ;
169- embeds:: edit_message_embed ( ctx, & mut old, err, None ) . await ;
168+ let mut err = embeds:: build_fail_embed ( & author, "Invalid command for edit functionality!" ) ;
169+ embeds:: edit_message_embed ( ctx, & mut old, & mut err, None ) . await ? ;
170170 }
171+
172+ Ok ( ( ) )
171173}
172174
173175pub async fn handle_edit_insights (
@@ -177,14 +179,13 @@ pub async fn handle_edit_insights(
177179 mut old : Message ,
178180 original_msg : Message ,
179181) -> CommandResult {
180- let ( details, embed) =
182+ let ( details, mut embed) =
181183 crate :: commands:: insights:: handle_request ( ctx. clone ( ) , content, author, & original_msg)
182184 . await ?;
183185
184- let compilation_successful = details. success ;
185- discordhelpers:: send_completion_react ( ctx, & old, compilation_successful) . await ?;
186+ discordhelpers:: send_completion_react ( ctx, & old, details. success ) . await ?;
186187
187- embeds:: edit_message_embed ( ctx, & mut old, embed, None ) . await ;
188+ embeds:: edit_message_embed ( ctx, & mut old, & mut embed, None ) . await ? ;
188189 Ok ( ( ) )
189190}
190191
@@ -195,13 +196,12 @@ pub async fn handle_edit_cpp(
195196 mut old : Message ,
196197 original_msg : Message ,
197198) -> CommandResult {
198- let ( embed, details) =
199+ let ( mut embed, details) =
199200 crate :: commands:: cpp:: handle_request ( ctx. clone ( ) , content, author, & original_msg) . await ?;
200201
201- let compilation_successful = details. success ;
202- discordhelpers:: send_completion_react ( ctx, & old, compilation_successful) . await ?;
202+ discordhelpers:: send_completion_react ( ctx, & old, details. success ) . await ?;
203203
204- embeds:: edit_message_embed ( ctx, & mut old, embed, Some ( details) ) . await ;
204+ embeds:: edit_message_embed ( ctx, & mut old, & mut embed, Some ( details) ) . await ? ;
205205 Ok ( ( ) )
206206}
207207
@@ -212,13 +212,13 @@ pub async fn handle_edit_compile(
212212 mut old : Message ,
213213 original_msg : Message ,
214214) -> CommandResult {
215- let ( embed, compilation_details) =
215+ let ( mut embed, compilation_details) =
216216 compile:: handle_request ( ctx. clone ( ) , content, author, & original_msg) . await ?;
217217
218218 let compilation_successful = compilation_details. success ;
219219 discordhelpers:: send_completion_react ( ctx, & old, compilation_successful) . await ?;
220220
221- embeds:: edit_message_embed ( ctx, & mut old, embed, Some ( compilation_details) ) . await ;
221+ embeds:: edit_message_embed ( ctx, & mut old, & mut embed, Some ( compilation_details) ) . await ? ;
222222 Ok ( ( ) )
223223}
224224
@@ -229,13 +229,11 @@ pub async fn handle_edit_asm(
229229 mut old : Message ,
230230 original_msg : Message ,
231231) -> CommandResult {
232- let ( emb, details) =
232+ let ( mut emb, details) =
233233 crate :: commands:: asm:: handle_request ( ctx. clone ( ) , content, author, & original_msg) . await ?;
234234
235- let success = details. success ;
236- embeds:: edit_message_embed ( ctx, & mut old, emb, Some ( details) ) . await ;
237-
238- send_completion_react ( ctx, & old, success) . await ?;
235+ send_completion_react ( ctx, & old, details. success ) . await ?;
236+ embeds:: edit_message_embed ( ctx, & mut old, & mut emb, Some ( details) ) . await ?;
239237 Ok ( ( ) )
240238}
241239
0 commit comments