feat: better error handling and fixed file size checking for /yt
This commit is contained in:
parent
935385eb4f
commit
62e7a1393b
2 changed files with 21 additions and 1 deletions
|
@ -94,6 +94,20 @@ module.exports = (bot) => {
|
|||
getApproxSize(ytDlpPath, videoUrl),
|
||||
]);
|
||||
|
||||
if (approxSizeInMB > 50) {
|
||||
await ctx.telegram.editMessageText(
|
||||
ctx.chat.id,
|
||||
downloadingMessage.message_id,
|
||||
null,
|
||||
Strings.ytDownload.uploadLimit, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id,
|
||||
},
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await ctx.telegram.editMessageText(
|
||||
ctx.chat.id,
|
||||
downloadingMessage.message_id,
|
||||
|
@ -134,7 +148,7 @@ module.exports = (bot) => {
|
|||
|
||||
fs.unlinkSync(mp4File);
|
||||
} catch (error) {
|
||||
if (toString(error).includes("Request Entity Too Large")) {
|
||||
if (error.response.description.includes("Request Entity Too Large")) {
|
||||
await ctx.telegram.editMessageText(
|
||||
ctx.chat.id,
|
||||
downloadingMessage.message_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue