Better error handling when sending a too large video
This commit is contained in:
parent
ac7d6f69d1
commit
ae8be193f5
1 changed files with 21 additions and 4 deletions
|
@ -145,10 +145,27 @@ module.exports = (bot) => {
|
||||||
|
|
||||||
fs.unlinkSync(mp4File);
|
fs.unlinkSync(mp4File);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await ctx.reply(Strings.ytFileError, {
|
if (error.includes("Request Entity Too Large")) {
|
||||||
|
await ctx.telegram.editMessageText(
|
||||||
|
ctx.chat.id,
|
||||||
|
downloadingMessage.message_id,
|
||||||
|
null,
|
||||||
|
Strings.ytUploadLimit, {
|
||||||
parse_mode: 'Markdown',
|
parse_mode: 'Markdown',
|
||||||
reply_to_message_id: ctx.message.message_id,
|
reply_to_message_id: ctx.message.message_id,
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await ctx.telegram.editMessageText(
|
||||||
|
ctx.chat.id,
|
||||||
|
downloadingMessage.message_id,
|
||||||
|
null,
|
||||||
|
Strings.ytFileError, {
|
||||||
|
parse_mode: 'Markdown',
|
||||||
|
reply_to_message_id: ctx.message.message_id,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
fs.unlinkSync(mp4File);
|
fs.unlinkSync(mp4File);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue