Skip to content

Commit

Permalink
Refactor download status reply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
besoeasy committed Nov 22, 2024
1 parent f6c4e48 commit ea9d2de
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions func/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,12 @@ const handleStatus = async (ctx, downloadId) => {
`Progress: ${completedSize} MB / ${totalSize} MB`;

if (downloadData.result.status === "active") {
reply += `\nCancel with /cancel_${downloadId}`;
} else if (downloadData.result.status === "complete") {
const files = downloadData.result.files
.map((file) => file.path)
.join("\n");
reply += `\nDownloaded Files:\n${files}`;
reply += `\nCancel with /cancel_${downloadId}\n\n`;
}

const files = downloadData.result.files.map((file) => file.path).join("\n");
reply += `\nDownloaded Files:\n${files}`;

ctx.reply(reply);
} catch (error) {
console.error(error);
Expand Down

0 comments on commit ea9d2de

Please sign in to comment.