Retry the fix
This commit is contained in:
		@@ -274,39 +274,39 @@ pub async fn edit_reminder(
 | 
			
		||||
                        reminder.channel, id
 | 
			
		||||
                    );
 | 
			
		||||
 | 
			
		||||
                    return Err(json!({"error": "Channel not found"}));
 | 
			
		||||
                }
 | 
			
		||||
                    error.push("Channel not found".to_string());
 | 
			
		||||
                } else {
 | 
			
		||||
                    let channel = create_database_channel(
 | 
			
		||||
                        ctx.inner(),
 | 
			
		||||
                        ChannelId::new(reminder.channel),
 | 
			
		||||
                        &mut transaction,
 | 
			
		||||
                    )
 | 
			
		||||
                    .await;
 | 
			
		||||
 | 
			
		||||
                let channel = create_database_channel(
 | 
			
		||||
                    ctx.inner(),
 | 
			
		||||
                    ChannelId::new(reminder.channel),
 | 
			
		||||
                    &mut transaction,
 | 
			
		||||
                )
 | 
			
		||||
                .await;
 | 
			
		||||
                    match channel {
 | 
			
		||||
                        Ok(channel) => {
 | 
			
		||||
                            match sqlx::query!(
 | 
			
		||||
                                "UPDATE reminders SET channel_id = ? WHERE uid = ?",
 | 
			
		||||
                                channel,
 | 
			
		||||
                                reminder.uid
 | 
			
		||||
                            )
 | 
			
		||||
                            .execute(transaction.executor())
 | 
			
		||||
                            .await
 | 
			
		||||
                            {
 | 
			
		||||
                                Ok(_) => {}
 | 
			
		||||
                                Err(e) => {
 | 
			
		||||
                                    warn!("Error setting channel: {:?}", e);
 | 
			
		||||
 | 
			
		||||
                if let Err(e) = channel {
 | 
			
		||||
                    warn!("`create_database_channel` returned an error code: {:?}", e);
 | 
			
		||||
                                    error.push("Couldn't set channel".to_string())
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    return Err(
 | 
			
		||||
                        json!({"error": "Failed to configure channel for reminders. Please check the bot permissions"}),
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
                        Err(e) => {
 | 
			
		||||
                            warn!("`create_database_channel` returned an error code: {:?}", e);
 | 
			
		||||
 | 
			
		||||
                let channel = channel.unwrap();
 | 
			
		||||
 | 
			
		||||
                match sqlx::query!(
 | 
			
		||||
                    "UPDATE reminders SET channel_id = ? WHERE uid = ?",
 | 
			
		||||
                    channel,
 | 
			
		||||
                    reminder.uid
 | 
			
		||||
                )
 | 
			
		||||
                .execute(transaction.executor())
 | 
			
		||||
                .await
 | 
			
		||||
                {
 | 
			
		||||
                    Ok(_) => {}
 | 
			
		||||
                    Err(e) => {
 | 
			
		||||
                        warn!("Error setting channel: {:?}", e);
 | 
			
		||||
 | 
			
		||||
                        error.push("Couldn't set channel".to_string())
 | 
			
		||||
                            error.push("Failed to configure channel for reminders. Please check the bot permissions".to_string());
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -317,14 +317,16 @@ pub async fn edit_reminder(
 | 
			
		||||
                    reminder.channel, id
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                return Err(json!({"error": "Channel not found"}));
 | 
			
		||||
                error.push("Channel not found".to_string());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if let Err(e) = transaction.commit().await {
 | 
			
		||||
        warn!("Couldn't commit transaction: {:?}", e);
 | 
			
		||||
        return json_err!("Couldn't commit transaction");
 | 
			
		||||
        return Err(
 | 
			
		||||
            json!({"reminder": Option::<GetReminder>::None, "errors": vec!["Unknown error"]}),
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    match sqlx::query_as_unchecked!(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user