fix: notify if bot activity detected by video provider

This commit is contained in:
Aidan 2025-06-22 17:07:48 -04:00
parent 8153ac2f33
commit 88e1f9fb42
3 changed files with 16 additions and 4 deletions

View file

@ -231,8 +231,18 @@ export default (bot) => {
} }
console.log("[i] Request completed\n") console.log("[i] Request completed\n")
} catch (error) { } catch (error) {
console.log("[!]", error.stderr) let errMsg = Strings.ytDownload.uploadErr
const errMsg = Strings.ytDownload.uploadErr
if (error.stderr.includes("--cookies-from-browser")) {
console.log("[!] Ratelimited by video provider:", error.stderr)
errMsg = Strings.ytDownload.botDetection
if (error.stderr.includes("youtube")) {
errMsg = Strings.ytDownload.botDetection.replace("video provider", "YouTube")
}
} else {
console.log("[!]", error.stderr)
}
// will no longer edit the message as the message context is not outside the try block // will no longer edit the message as the message context is not outside the try block
await ctx.reply(errMsg, { await ctx.reply(errMsg, {
parse_mode: 'Markdown', parse_mode: 'Markdown',

View file

@ -76,7 +76,8 @@
"uploadErr": "Error uploading file. Please try again later.", "uploadErr": "Error uploading file. Please try again later.",
"uploadLimit": "*This video exceeds the 50 MB upload limit imposed by Telegram on our bot. Please try another video. We're doing our best to increase this limit.*", "uploadLimit": "*This video exceeds the 50 MB upload limit imposed by Telegram on our bot. Please try another video. We're doing our best to increase this limit.*",
"sizeLimitWarn": "*This video had its quality reduced because it exceeded the 50MB limit for uploads imposed by Telegram.*", "sizeLimitWarn": "*This video had its quality reduced because it exceeded the 50MB limit for uploads imposed by Telegram.*",
"noLink": "Please provide a link to a video to download." "noLink": "Please provide a link to a video to download.",
"botDetection": "My server is being rate limited by the video provider! Please try again later, or ask the bot owner to add their cookies/account."
}, },
"botUpdated": "Bot updated with success.\n\n```{result}```", "botUpdated": "Bot updated with success.\n\n```{result}```",
"errorUpdatingBot": "Error updating bot\n\n{error}", "errorUpdatingBot": "Error updating bot\n\n{error}",

View file

@ -76,7 +76,8 @@
"uploadErr": "Erro ao enviar o arquivo. Tente novamente mais tarde.", "uploadErr": "Erro ao enviar o arquivo. Tente novamente mais tarde.",
"uploadLimit": "*Este vídeo excede o limite de carregamento de 50 MB imposto pelo Telegram ao nosso bot. Por favor, tente outro vídeo. Estamos fazendo o possível para aumentar esse limite.*", "uploadLimit": "*Este vídeo excede o limite de carregamento de 50 MB imposto pelo Telegram ao nosso bot. Por favor, tente outro vídeo. Estamos fazendo o possível para aumentar esse limite.*",
"sizeLimitWarn": "*Esse vídeo teve a qualidade reduzida por estar excedendo o limite de 50MB para uploads imposto pelo Telegram.*", "sizeLimitWarn": "*Esse vídeo teve a qualidade reduzida por estar excedendo o limite de 50MB para uploads imposto pelo Telegram.*",
"noLink": "*Por favor, forneça um link de um vídeo para download.*" "noLink": "*Por favor, forneça um link de um vídeo para download.*",
"botDetection": "Meu servidor está com a taxa limitada pelo provedor de vídeo! Tente novamente mais tarde ou peça ao proprietário do bot para adicionar seus cookies/conta."
}, },
"botUpdated": "Bot atualizado com sucesso.\n\n```{result}```", "botUpdated": "Bot atualizado com sucesso.\n\n```{result}```",
"errorUpdatingBot": "Erro ao atualizar o bot\n\n{error}", "errorUpdatingBot": "Erro ao atualizar o bot\n\n{error}",