From b3b7eca5c70749b8ed70b7e3d80bf9663e291865 Mon Sep 17 00:00:00 2001 From: lucmsilva651 Date: Mon, 9 Sep 2024 18:11:06 -0300 Subject: [PATCH] Translations + more fixes on help buttons --- commands/main.js | 46 ++++++++++++++++------------- locales/english.json | 55 +++++++++++++++++----------------- locales/portuguese.json | 65 +++++++++++++++++++++-------------------- 3 files changed, 86 insertions(+), 80 deletions(-) diff --git a/commands/main.js b/commands/main.js index 0b7a333..471174e 100644 --- a/commands/main.js +++ b/commands/main.js @@ -9,15 +9,15 @@ async function sendHelpMessage(ctx, isEditing) { parse_mode: 'Markdown', reply_markup: { inline_keyboard: [ - [{ text: Strings.information, callback_data: '1' }, { text: Strings.check, callback_data: '2' }], - [{ text: Strings.intemojis, callback_data: '3' }, { text: Strings.botinfo, callback_data: '4' }] + [{ text: Strings.mainCommands, callback_data: '1' }, { text: Strings.usefulCommands, callback_data: '2' }], + [{ text: Strings.interactiveEmojis, callback_data: '3' }, { text: Strings.funnyCommands, callback_data: '4' }] ] } }; const helpText = Strings.lynxHelp; - if(isEditing){ + if (isEditing) { await ctx.editMessageText(helpText, options); - }else{ + } else { await ctx.reply(helpText, options); } } @@ -27,10 +27,10 @@ module.exports = (bot) => { const Strings = getStrings(ctx.from.language_code); ctx.replyWithPhoto( resources.lunaCat, { - caption: Strings.lynxWelcome, - parse_mode: 'Markdown', - reply_to_message_id: ctx.message.message_id - } + caption: Strings.lynxWelcome, + parse_mode: 'Markdown', + reply_to_message_id: ctx.message.message_id + } ); }); @@ -41,34 +41,38 @@ module.exports = (bot) => { bot.on('callback_query', async (ctx) => { const callbackData = ctx.callbackQuery.data; const Strings = getStrings(ctx.from.language_code); - const options = {reply_markup: JSON.stringify({ - inline_keyboard: [ - [{ text: Strings.goback, callback_data: '5' }], - ]}) + const options = { + parse_mode: 'Markdown', + reply_markup: JSON.stringify({ + inline_keyboard: [ + [{ text: Strings.goBack, callback_data: '5' }], + ] + }) }; + switch (callbackData) { case '1': await ctx.answerCbQuery(); - await ctx.editMessageText(Strings.informationHelp, options); + await ctx.editMessageText(Strings.mainCommandsDesc, options); break; case '2': await ctx.answerCbQuery(); - await ctx.editMessageText(Strings.funnyChecksHelp, options); + await ctx.editMessageText(Strings.usefulCommandsDesc, options); break; case '3': await ctx.answerCbQuery(); - await ctx.editMessageText(Strings.interactiveEmojisHelp, options); + await ctx.editMessageText(Strings.interactiveEmojisDesc, options); break; case '4': await ctx.answerCbQuery(); - await ctx.editMessageText(Strings.botInfoHelp, options); + await ctx.editMessageText(Strings.funnyCommandsDesc, options); break; case '5': await ctx.answerCbQuery(); await sendHelpMessage(ctx, true); break; default: - await ctx.answerCbQuery('Woops! Invalid option'); + await ctx.answerCbQuery(Strings.invalidOption); break; } }); @@ -77,10 +81,10 @@ module.exports = (bot) => { const Strings = getStrings(ctx.from.language_code); ctx.reply( Strings.lynxPrivacy, { - parse_mode: 'Markdown', - disable_web_page_preview: true, - reply_to_message_id: ctx.message.message_id - } + parse_mode: 'Markdown', + disable_web_page_preview: true, + reply_to_message_id: ctx.message.message_id + } ); }); }; \ No newline at end of file diff --git a/locales/english.json b/locales/english.json index 0758382..39ac8b2 100644 --- a/locales/english.json +++ b/locales/english.json @@ -1,34 +1,35 @@ { - "lynxWelcome": "*Hello! I am Lynx!*\nI was made with love by Lucas Gabriel (lucmsilva)!\n\n*Before using, you will need to read the privacy policy (/privacy) to understand where your data goes when using this bot.*\n\nAlso, you can use /help to show the bot commands!", - "lynxHelp": "*Help\n*Hey, I'm Lynx, a simple bot made entirely from scratch in Telegraf and Node.js by Lucas Gabriel (lucmsilva).\n\n*Click on the buttons below to know which commands you can use!*\n\n*Special thanks to @givfnz2 for his many contributions to the bot!*", - "lynxPrivacy": "Check out [this link](https://blog.eleu.me/posts/lynx-privacy-policy) to read the bot privacy policy.", + "lynxWelcome": "*Hello! I am Lynx!*\nI was made with love by Lucas Gabriel (@lukig1)!\n\n*Before using, you need to read the privacy policy (/privacy) to understand where your data goes when using this bot.*\n\nAlso, you can use /help to see the bot commands!", + "lynxHelp": "*Hey, I'm Lynx, a simple bot made entirely from scratch in Telegraf and Node.js by Lucas Gabriel (lucmsilva).*\n\nClick on the buttons below to see which commands you can use!\n\n*Special thanks to @givfnz2 for his many contributions to the bot!*", + "lynxPrivacy": "Check out [this link](https://blog.eleu.me/posts/lynx-privacy-policy) to read the bot's privacy policy.", "unKnown": "Unknown", "varYes": "Yes", "varNo": "No", "varNone": "None", - "kickingMyself": "*Since you don't need me, I'll get out of here.*", + "invalidOption": "Whoops! Invalid option!", + "kickingMyself": "*Since you don't need me, I'll leave.*", "kickingMyselfErr": "Error leaving the chat.", - "noPermission": "You don't have permissions to run this command.", + "noPermission": "You don't have permission to run this command.", "botAdminOnly": "This command is exclusive to the bot's general administrators. I can't disclose who they are, nor what this command does.", - "privateOnly": "This command should be used only on private chats, and not on groups.", - "groupOnly": "This command should be used only on groups, and not on private chats.", - "botNameChanged": "*Bot name changed to* `{botName}.`", - "botNameErr": "*Error when changing bot name:*\n{tgErr}", - "botDescChanged": "*Bot description changed to* `{botDesc}.`", - "botDescErr": "*Error when changing bot description:*\n{tgErr}", + "privateOnly": "This command should only be used in private chats, not in groups.", + "groupOnly": "This command should only be used in groups, not in private chats.", + "botNameChanged": "*Bot name changed to* `{botName}`.", + "botNameErr": "*Error changing bot name:*\n`{tgErr}`", + "botDescChanged": "*Bot description changed to* `{botDesc}`.", + "botDescErr": "*Error changing bot description:*\n`{tgErr}`", "invalidId": "Please enter a valid user ID.", "banSuccess": "User with ID `{userId}` has been banned.", - "banErr": "Could not ban the user. Please check if the ID is correct and if the bot has admin permissions.\n\n{tgErr}", + "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. Please check if the ID is correct and if the bot has admin permissions.\n\n{tgErr}", + "unBanErr": "Could not unban the user. Check if the ID is correct and if the bot has admin permissions.\n\n`{tgErr}`", "isGay": "Yes, you are *gay*!", - "isNtGay": "Aahhh. You are not gay!", + "isNtGay": "Ah, you are not gay!", "isFurry": "Yes, you are *furry*!", - "isNtFurry": "Aahhh. You are not a furry!", + "isNtFurry": "Ah, you are not a furry!", "randomNum": "*Generated number (0-10):* `{number}`.", "userInfo": "*User info*\n\n*Name:* `{userName}`\n*Username:* `{userHandle}`\n*User ID:* `{userId}`\n*Language:* `{userLang}`\n*Premium user:* `{userPremium}`", "chatInfo": "*Chat info*\n\n*Name:* `{chatName}`\n*Chat ID:* `{chatId}`\n*Handle:* `{chatHandle}`\n*Type:* `{chatType}`\n*Members:* `{chatMembersCount}`\n*Is a forum:* `{isForum}`", - "funEmojiResult": "*You rolled {emoji} and got *`{value}`*!*\nYou don't know what that means? Me too!", + "funEmojiResult": "*You rolled {emoji} and got* `{value}`*!*\nYou don't know what that means? Me neither!", "gifErr": "*Something went wrong while sending the GIF. Please try again later.*\n\n{err}", "lastFmNoUser": "*Please provide a Last.fm username.*\nExample: `/lt username`", "lastFmNoRecent": "*No recent tracks found for Last.fm user* `{lastfmUser}`*.*", @@ -37,14 +38,14 @@ "lastFmStatusFor": "*Last.fm status for user* {lastfmUser}*:*\n\n*{nowPlaying}*: {trackName} by {artistName} \n\n*Number of plays*: {plays}", "lastFmErr": "*Error retrieving data for Last.fm user* {lastfmUser}.", "currentCommit": "*Current commit:* `{commitHash}`", - "errorRetrievingCommit": "*Error retrieving commit:* {error}", - "informationHelp": "[INFORMATION COMMANDS]\n• /chatinfo - send some information about the group\n• /userinfo - send some information about yourself\n• /d [DEVICE_MODEL] - search for a device and send its specs\n• /lt [USER_NAME]: send last song from USER_NAME's LastFM and number of plays. Also works with /lt, /lmu, /last, /lfm", - "funnyChecksHelp": "[CHECKS COMMANDS]\n• /gay: check if you are gay\n• /furry: check if you are a furry\n• /random: pick a random number between 0-10", - "interactiveEmojisHelp": "[INTERACTIVE EMOJIS COMMANDS]\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 in the goal!\n• /bowling: Try to hit the pins!\n• /dart: Try to hit the target! ", - "botInfoHelp": "[BOT INFO COMMANDS]\n• /help: Show bot's help\n• /start: Starts the bot\n• /privacy: Read the bot's Privacy Policy", - "information": "Informations", - "check": "Checks", - "intemojis": "Interactive emojis", - "botinfo": "Bot info", - "goback": "⬅️ Go back" -} + "errorRetrievingCommit": "*Error retrieving commit:* `{error}`", + "mainCommands": "Main commands", + "mainCommandsDesc": "*Main commands*\n\n- /help: Show bot's help\n- /start: Start the bot\n- /privacy: Read the bot's Privacy Policy", + "usefulCommands": "Useful commands", + "usefulCommandsDesc": "*Useful commands*\n\n- /chatinfo: Send information about the group\n- /userinfo: Send information about yourself\n- /d | /device ``: Search for a device on GSMArena and show its specs.\n- /lt | /lmu | /last | /lfm ``: Show the last song from a specified Last.fm profile + number of plays.", + "funnyCommands": "Funny commands", + "funnyCommandsDesc": "*Funny commands*\n\n- /gay: Check if you are gay\n- /furry: Check if you are a furry\n- /random: Pick a random number between 0-10", + "interactiveEmojis": "Interactive emojis", + "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" +} \ No newline at end of file diff --git a/locales/portuguese.json b/locales/portuguese.json index 915968d..1e70079 100644 --- a/locales/portuguese.json +++ b/locales/portuguese.json @@ -1,20 +1,21 @@ { - "lynxWelcome": "*Olá! Eu sou o Lynx!*\nEu fui feito com amor por Lucas Gabriel (lucmsilva)!\n\n*Antes de usar, você precisará ler a política de privacidade (/privacy) para entender para onde seus dados vão ao usar este bot.\n\n*Além disso, você pode usar o /help para mostrar os comandos do bot.", - "lynxHelp": "*Olá! Eu sou o Lynx!*\n\nSou um simples bot feito inteiramente do zero em Telegraf e Node.js por Lucas Gabriel (lucmsilva).\n\nClique nos botões abaixo para saber quais comandos utilizar.\n\n*Um agradecimento especial a @givfnz2 pelas várias contribuições ao bot!*", - "lynxPrivacy": "Dê uma olhada [nesse link](https://blog.eleu.me/posts/lynx-privacy-policy) para ler a política de privacidade do bot.", + "lynxWelcome": "*Olá! Eu sou o Lynx!*\nFui feito com carinho por Lucas Gabriel (@lukig1)!\n\n*Antes de usar, você precisa ler a política de privacidade (/privacy) para entender onde seus dados vão ao usar este bot.*\n\nAlém disso, você pode usar /help para ver os comandos do bot!", + "lynxHelp": "*Oi, eu sou o Lynx, um bot simples feito do zero em Telegraf e Node.js por Lucas Gabriel (lucmsilva).*\n\nClique nos botões abaixo para ver quais comandos você pode usar!\n\n*Agradecimento especial ao @givfnz2 pelas suas várias contribuições ao bot!*", + "lynxPrivacy": "Acesse [este link](https://blog.eleu.me/posts/lynx-privacy-policy) para ler a política de privacidade do bot.", "unKnown": "Desconhecido", "varYes": "Sim", "varNo": "Não", "varNone": "Nenhum", - "kickingMyself": "*Já que você não precisa de mim, vou ir embora.*", + "invalidOption": "Ops! Opção inválida!", + "kickingMyself": "*Já que você não precisa de mim, vou sair daqui.*", "kickingMyselfErr": "Erro ao sair do chat.", - "noPermission": "Você não tem permissões para rodar esse comando.", - "botAdminOnly": "Esse comando é exclusivo a administradores gerais do bot. Não posso informar quem são, e nem o que esse comando faz.", - "privateOnly": "Esse comando deve ser utilizado apenas em chats privados, e não em grupos.", - "groupOnly": "Esse comando deve ser utilizado apenas em grupos, e não em chats privados.", - "botNameChanged": "*Nome do bot alterado para* `{botName}.`", + "noPermission": "Você não tem permissão para executar este comando.", + "botAdminOnly": "Este comando é exclusivo para os administradores gerais do bot. Eu não posso revelar quem eles são, nem o que este comando faz.", + "privateOnly": "Este comando deve ser usado apenas em chats privados, não em grupos.", + "groupOnly": "Este comando deve ser usado apenas em grupos, não em chats privados.", + "botNameChanged": "*Nome do bot alterado para* `{botName}`.", "botNameErr": "*Erro ao alterar o nome do bot:*\n`{tgErr}`", - "botDescChanged": "*Descrição do bot alterada para* `{botDesc}.`", + "botDescChanged": "*Descrição do bot alterada para* `{botDesc}`.", "botDescErr": "*Erro ao alterar a descrição do bot:*\n`{tgErr}`", "invalidId": "Por favor, insira um ID de usuário válido.", "banSuccess": "Usuário com ID `{userId}` foi banido.", @@ -22,29 +23,29 @@ "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*!", - "isNtGay": "Aahhh. Você não é gay!", + "isNtGay": "Ah, você não é gay!", "isFurry": "Sim, você é *furry*!", - "isNtFurry": "Aahhh. Você não é um furry!", + "isNtFurry": "Ah, você não é furry!", "randomNum": "*Número gerado (0-10):* `{number}`.", - "userInfo": "*Informações do usuário*\n\n*Nome:* `{userName}`\n*Usuário:* `{userHandle}`\n*ID:* `{userId}`\n*Idioma:* `{userLang}`\n*Usuário Premium:* `{userPremium}`", - "chatInfo": "*Informações do chat*\n\n*Nome:* `{chatName}`\n*ID do chat:* `{chatId}`\n*Identificador:* `{chatHandle}`\n*Tipo:* `{chatType}`\n*Membros:* `{chatMembersCount}`\n*É um fórum:* `{isForum}`", - "funEmojiResult": "*Você lançou {emoji} e obteve *`{value}`*!*\nVocê não sabe o que isso significa? Nem eu!", - "gifErr": "*Algo deu errado ao enviar o GIF. Tente novamente mais tarde.*\n\n{err}", - "lastFmNoUser": "*Por favor, forneça um nome de usuário do Last.fm.*\nExemplo: `/lt username`", - "lastFmNoRecent": "*Nenhas faixas recentes encontradas para o usuário do Last.fm* `{lastfmUser}`*.*", + "userInfo": "*Informações do usuário*\n\n*Nome:* `{userName}`\n*Usuário:* `{userHandle}`\n*ID do usuário:* `{userId}`\n*Idioma:* `{userLang}`\n*Usuário premium:* `{userPremium}`", + "chatInfo": "*Informações do chat*\n\n*Nome:* `{chatName}`\n*ID do chat:* `{chatId}`\n*Handle:* `{chatHandle}`\n*Tipo:* `{chatType}`\n*Número de membros:* `{chatMembersCount}`\n*É um fórum:* `{isForum}`", + "funEmojiResult": "*Você jogou {emoji} e conseguiu* `{value}`*!*\nVocê não sabe o que isso significa? Nem eu!", + "gifErr": "*Algo deu errado ao enviar o GIF. Por favor, tente novamente mais tarde.*\n\n{err}", + "lastFmNoUser": "*Por favor, forneça um nome de usuário Last.fm.*\nExemplo: `/lt username`", + "lastFmNoRecent": "*Nenhuma música recente encontrada para o usuário Last.fm* `{lastfmUser}`*.*", "lastFmListeningNow": "Ouvindo agora", - "lastFmLastPlayed": "Última reprodução", - "lastFmStatusFor": "*Status do Last.fm para o usuário* {lastfmUser}*:*\n\n*{nowPlaying}*: {trackName} por {artistName}\n\n*Numero de plays*: {plays}", - "lastFmErr": "*Erro ao recuperar dados para o usuário do Last.fm* {lastfmUser}.", + "lastFmLastPlayed": "Última música ouvida", + "lastFmStatusFor": "*Status do Last.fm para o usuário* {lastfmUser}*:*\n\n*{nowPlaying}*: {trackName} por {artistName} \n\n*Número de reproduções*: {plays}", + "lastFmErr": "*Erro ao recuperar dados para o usuário Last.fm* {lastfmUser}.", "currentCommit": "*Commit atual:* `{commitHash}`", - "errorRetrievingCommit": "*Erro ao obter o commit:* {error}", - "informationHelp": "Hello World", - "funnyChecksHelp": "Hello World", - "interactiveEmojisHelp": "Hello World", - "botInfoHelp": "[BOT INFO COMMANDS]\n • /help: Mostra a ajuda do bot\n • /start: Starts the bot\n • /privacy: Read the bot's Privacy Policy", - "information": "Informações", - "check": "Checagens", - "intemojis": "Emojis interativos", - "botinfo": "Infos do bot", - "goback": "⬅️ Voltar" -} + "errorRetrievingCommit": "*Erro ao recuperar commit:* `{error}`", + "mainCommands": "Comandos principais", + "mainCommandsDesc": "*Comandos principais*\n\n- /help: Exibe a ajuda do bot\n- /start: Inicia o bot\n- /privacy: Leia a política de privacidade do bot", + "usefulCommands": "Comandos úteis", + "usefulCommandsDesc": "*Comandos úteis*\n\n- /chatinfo: Envia informações sobre o grupo\n- /userinfo: Envia informações sobre você\n- /d | /device ``: Pesquisa um dispositivo no GSMArena e mostra suas especificações.\n- /lt | /lmu | /last | /lfm ``: Mostra a última música de um perfil especificado no Last.fm + o número de reproduções.", + "funnyCommands": "Comandos engraçados", + "funnyCommandsDesc": "*Comandos engraçados*\n\n- /gay: Verifique se você é gay\n- /furry: Verifique se você é furry\n- /random: Escolhe um número aleatório entre 0-10", + "interactiveEmojis": "Emojis interativos", + "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" +} \ No newline at end of file