mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 12:49:57 +00:00
Temporary fix for 50MB issue
This commit is contained in:
parent
4ffb5c3972
commit
236bad0576
@ -60,27 +60,48 @@ module.exports = (bot) => {
|
||||
});
|
||||
|
||||
if (fs.existsSync(mp4File)) {
|
||||
const userId = parseInt(ctx.match[2]);
|
||||
const userName = ctx.from.first_name;
|
||||
const message = strings.ytUploadDesc
|
||||
.replace("{userId}", userId)
|
||||
.replace("{userName}", userName);
|
||||
.replace("{userName}", ctx.from.first_name);
|
||||
|
||||
await ctx.replyWithVideo({
|
||||
source: mp4File,
|
||||
caption: `${message}`,
|
||||
parse_mode: 'Markdown'
|
||||
fs.stat(mp4File, async (err, stats) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
};
|
||||
|
||||
const mbSize = stats.size / (1024 * 1024);
|
||||
|
||||
if (mbSize > 50) {
|
||||
await ctx.reply(strings.ytUploadLimit, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id,
|
||||
});
|
||||
|
||||
fs.unlinkSync(mp4File);
|
||||
} else {
|
||||
try {
|
||||
await ctx.replyWithVideo({
|
||||
source: mp4File,
|
||||
caption: `${message}`,
|
||||
parse_mode: 'Markdown',
|
||||
});
|
||||
} catch (error) {
|
||||
await ctx.reply(`\`${error}\``, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id,
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
fs.unlinkSync(mp4File);
|
||||
}
|
||||
} catch (error) {
|
||||
};
|
||||
} catch (downloadError) {
|
||||
fs.unlinkSync(mp4File);
|
||||
const message = strings.ytDownloadErr
|
||||
.replace("{err}", error)
|
||||
.replace("{userName}", ctx.from.first_name);
|
||||
|
||||
ctx.reply(message, {
|
||||
await ctx.reply(message, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id,
|
||||
});
|
||||
|
@ -61,5 +61,6 @@
|
||||
"ytDownloading": "*Downloading video...*",
|
||||
"ytUploading": "*Uploading video...*",
|
||||
"ytUploadDesc": "*[{userName}](tg://user?id={userId}), there is your downloaded video.*",
|
||||
"ytDownloadErr": "*Error during YT video download:*\n\n`{err}`"
|
||||
"ytDownloadErr": "*Error during YT video download:*\n\n`{err}`",
|
||||
"ytUploadLimit": "*You have reached the 50MB upload limit for the bot. Try another video. We're trying our best to increase the limit.*"
|
||||
}
|
@ -61,5 +61,6 @@
|
||||
"ytDownloading": "*Baixando vídeo...*",
|
||||
"ytUploading": "*Enviando video...*",
|
||||
"ytUploadDesc": "*[{userName}](tg://user?id={userId}), aqui está o seu vídeo baixado.*",
|
||||
"ytDownloadErr": "*Erro durante o download do vídeo do YT:*\n\n`{err}`"
|
||||
"ytDownloadErr": "*Erro durante o download do vídeo do YT:*\n\n`{err}`",
|
||||
"ytUploadLimit": "*Você atingiu o limite de upload de 50MB para o bot. Tente outro vídeo. Estamos tentando o máximo para aumentar o limite.*"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user