diff --git a/commands/youtube.js b/commands/youtube.js index 7d4013a..3bcaf70 100644 --- a/commands/youtube.js +++ b/commands/youtube.js @@ -1,5 +1,6 @@ var exec = require('child_process').exec; const fs = require('fs'); +const { getStrings } = require('../plugins/checklang'); async function DownloadFromYoutube(command) { return new Promise((resolve, reject) => { @@ -16,19 +17,17 @@ async function DownloadFromYoutube(command) { module.exports = (bot) => { bot.command('yt', async (ctx) => { + const Strings = getStrings(ctx.from.language_code); const args = ctx.message.text.split(' ').slice(1).join(' '); const ytCommand = 'yt-dlp ' + args + ' -o video.mp4'; + ctx.reply(Strings.downloading); await DownloadFromYoutube(ytCommand); try { + ctx.reply(Strings.uploading); await ctx.replyWithVideo({ source: 'video.mp4' }); } catch (error) { - console.log(error); + ctx.reply('Error!') } - try { - fs.unlinkSync('video.mp4'); - } catch (error) { - console.log(error) - } - } - ) + fs.unlinkSync('video.mp4'); + }) } \ No newline at end of file diff --git a/locales/english.json b/locales/english.json index fd96558..c0310b0 100644 --- a/locales/english.json +++ b/locales/english.json @@ -57,5 +57,7 @@ "interactiveEmojisDesc": "*Interactive emojis*\n\n- /dice: Roll a dice\n- /idice: Infinitely roll a colored dice\n- /slot: Try to combine the figures!\n- /ball: Try to kick the ball into the goal!\n- /bowling: Try to hit the pins!\n- /dart: Try to hit the target!", "goBack": "Back", "maInvalidModule": "Please provide a valid module ID from The Mod Archive.\nExample: `/modarchive 81574`", - "maDownloadError": "Error downloading the file. Check the module ID and try again." + "maDownloadError": "Error downloading the file. Check the module ID and try again.", + "downloading": "Downloading...", + "uploading": "Uploading. Please, hold on..." } \ No newline at end of file diff --git a/locales/portuguese.json b/locales/portuguese.json index 10d8395..2adb7a7 100644 --- a/locales/portuguese.json +++ b/locales/portuguese.json @@ -57,5 +57,7 @@ "interactiveEmojisDesc": "*Emojis interativos*\n\n- /dice: Jogue um dado\n- /idice: Role infinitamente um dado colorido\n- /slot: Tente combinar as figuras!\n- /ball: Tente chutar a bola no gol!\n- /bowling: Tente derrubar os pinos!\n- /dart: Tente acertar o alvo!", "goBack": "Voltar", "maInvalidModule": "Por favor, forneça um ID de módulo válido do The Mod Archive.\nExemplo: `/modarchive 81574`", - "maDownloadError": "Erro ao baixar o arquivo. Verifique o ID do módulo e tente novamente." + "maDownloadError": "Erro ao baixar o arquivo. Verifique o ID do módulo e tente novamente.", + "downloading": "Fazendo download...", + "uploading": "Fazendo upload. Por favor, aguarde um momento..." } \ No newline at end of file