mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 07:25:36 +01:00
Update
This commit is contained in:
@@ -454,7 +454,7 @@ async fn download_archive(
|
|||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut i = 15 * 60 / 5;
|
let mut i = 15 * 60 / 5;
|
||||||
|
|
||||||
while task.status != TaskStatus::Complete && i >= 0 {
|
while task.status == TaskStatus::InProgress && i >= 0 {
|
||||||
task = match get_task(task.id).await {
|
task = match get_task(task.id).await {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -470,6 +470,18 @@ async fn download_archive(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bot
|
||||||
|
.edit_message_text(
|
||||||
|
message.chat.id,
|
||||||
|
message.id,
|
||||||
|
format!("Подготовка архива: {}", task.status_description)
|
||||||
|
)
|
||||||
|
.reply_markup(InlineKeyboardMarkup {
|
||||||
|
inline_keyboard: vec![],
|
||||||
|
})
|
||||||
|
.send()
|
||||||
|
.await?;
|
||||||
|
|
||||||
sleep(Duration::from_secs(5)).await;
|
sleep(Duration::from_secs(5)).await;
|
||||||
|
|
||||||
i -= 1;
|
i -= 1;
|
||||||
@@ -485,6 +497,10 @@ async fn download_archive(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
} else {
|
||||||
|
bot
|
||||||
|
.delete_message(message.chat.id, message.id)
|
||||||
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let downloaded_data = match download_file_by_link(
|
let downloaded_data = match download_file_by_link(
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pub enum TaskStatus {
|
|||||||
InProgress,
|
InProgress,
|
||||||
Archiving,
|
Archiving,
|
||||||
Complete,
|
Complete,
|
||||||
|
Failled
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|||||||
Reference in New Issue
Block a user