From 7c8dba27f9d45311106224a9918e60f70eae8a81 Mon Sep 17 00:00:00 2001 From: GiovaniFZ Date: Sat, 14 Dec 2024 15:30:26 -0300 Subject: [PATCH] feat: Show error properly to the user on yt command --- src/commands/youtube.js | 4 ++-- src/locales/english.json | 1 + src/locales/portuguese.json | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/youtube.js b/src/commands/youtube.js index fe183e7..5ac86b3 100644 --- a/src/commands/youtube.js +++ b/src/commands/youtube.js @@ -139,7 +139,7 @@ module.exports = (bot) => { fs.unlinkSync(mp4File); } catch (error) { - await ctx.reply(`\`${error.message}\``, { + await ctx.reply(Strings.error, { parse_mode: 'Markdown', reply_to_message_id: ctx.message.message_id, }); @@ -165,7 +165,7 @@ module.exports = (bot) => { } } catch (error) { console.error(error); - await ctx.reply(`\`${error.message}\``, { + await ctx.reply(Strings.error, { parse_mode: 'Markdown', reply_to_message_id: ctx.message.message_id, }); diff --git a/src/locales/english.json b/src/locales/english.json index b65228f..aa7ca14 100644 --- a/src/locales/english.json +++ b/src/locales/english.json @@ -24,6 +24,7 @@ "banErr": "Could not ban the user. Check if the ID is correct and if the bot has admin permissions.\n\n`{tgErr}`", "unBanSuccess": "User with ID `{userId}` has been unbanned.", "unBanErr": "Could not unban the user. Check if the ID is correct and if the bot has admin permissions.\n\n`{tgErr}`", + "error": "An unexpected error occured. Please, report to the developers.", "isGay": "Yes, you are *gay*!", "isNtGay": "Ah, you are not gay!", "isFurry": "Yes, you are *furry*!", diff --git a/src/locales/portuguese.json b/src/locales/portuguese.json index 167cca9..f8a4aa1 100644 --- a/src/locales/portuguese.json +++ b/src/locales/portuguese.json @@ -22,6 +22,7 @@ "invalidId": "Por favor, insira um ID de usuário válido.", "banSuccess": "Usuário com ID `{userId}` foi banido.", "banErr": "Não foi possível banir o usuário. Verifique se o ID está correto e se o bot tem permissões de administrador.\n\n`{tgErr}`", + "error": "Um erro inesperado ocorreu, por favor reporte ao desenvolvedor", "unBanSuccess": "Usuário com ID `{userId}` foi desbanido.", "unBanErr": "Não foi possível desbanir o usuário. Verifique se o ID está correto e se o bot tem permissões de administrador.\n\n`{tgErr}`", "isGay": "Sim, você é *gay*!",