diff --git a/commands/main.js b/commands/main.js index 874840f..471174e 100644 --- a/commands/main.js +++ b/commands/main.js @@ -3,37 +3,88 @@ const { getStrings } = require('../plugins/checklang.js'); const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js'); const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch); +async function sendHelpMessage(ctx, isEditing) { + const Strings = getStrings(ctx.from.language_code); + const options = { + parse_mode: 'Markdown', + reply_markup: { + inline_keyboard: [ + [{ 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) { + await ctx.editMessageText(helpText, options); + } else { + await ctx.reply(helpText, options); + } +} + module.exports = (bot) => { bot.start(spamwatchMiddleware, async (ctx) => { 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 + } ); }); bot.help(spamwatchMiddleware, async (ctx) => { + await sendHelpMessage(ctx); + }); + + bot.on('callback_query', async (ctx) => { + const callbackData = ctx.callbackQuery.data; const Strings = getStrings(ctx.from.language_code); - ctx.replyWithPhoto( - resources.lunaCat2, { - caption: Strings.lynxHelp, - parse_mode: 'Markdown', - reply_to_message_id: ctx.message.message_id - } - ); + 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.mainCommandsDesc, options); + break; + case '2': + await ctx.answerCbQuery(); + await ctx.editMessageText(Strings.usefulCommandsDesc, options); + break; + case '3': + await ctx.answerCbQuery(); + await ctx.editMessageText(Strings.interactiveEmojisDesc, options); + break; + case '4': + await ctx.answerCbQuery(); + await ctx.editMessageText(Strings.funnyCommandsDesc, options); + break; + case '5': + await ctx.answerCbQuery(); + await sendHelpMessage(ctx, true); + break; + default: + await ctx.answerCbQuery(Strings.invalidOption); + break; + } }); bot.command('privacy', spamwatchMiddleware, async (ctx) => { 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 05eebd0..647baf5 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": "*Hello! I'm Lynx!*\n\nI'm a simple bot made entirely from scratch in Telegraf and Node.js by Lucas Gabriel (lucmsilva).\n\n*Profile photo/help:* [@monkeycatluna on ig](https://www.instagram.com/monkeycatluna/)\n\n*Some commands to test:*\n• */chatinfo* - send some information about the group\n• */customize* - customize your pronouns (WIP)\n• */dice* - send an emoji of a dice (random results)\n• */furry* - check if you are a furry\n• */gay* - check if you are gay\n• */help* - send this message\n• */privacy* - read the Privacy Policy\n• */random* - pick a random number between 0-10\n• */start* - start the bot\n• */slot* - send an interactive emoji of a casino slot\n• */userinfo* - send some information about yourself\n\n*See my source code in my* [GitHub repository](https://github.com/lucmsilva651/lynx)*.*\n\nThanks to all users, testers, contributors, and others. Without you, perhaps this bot wouldn't be possible ❤️\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}`*.*", @@ -41,5 +42,14 @@ "provideLocation": "*Please provide a location.*", "invalidLocation": "*Invalid location. Try again.*", "weatherStatus": "*Weather in {addressFirst}:*\n\n*Status:* `{getStatusEmoji(iconCode)} {wxPhraseLong}`\n*Temperature:* `{temperature} °{temperatureUnit}`\n*Feels like:* `{temperatureFeelsLike} °{temperatureUnit2}`\n*Humidity:* `{relativeHumidity}%`\n*Wind speed:* `{windSpeed} {speedUnit}`", - "weatherErr": "*An error occurred while retrieving the weather. Please try again later.*\n\n`{error}`" + "weatherErr": "*An error occurred while retrieving the weather. Please try again later.*\n\n`{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 404db00..09713cf 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\n*Foto de perfil/ajuda:* [@monkeycatluna no ig](https://www.instagram.com/monkeycatluna/)\n\n*Alguns comandos para testar:*\n• */chatinfo* - envia algumas informações sobre o grupo\n• */customize* - customiza seus pronomes (WIP)\n• */furry* - checa se você é um furry\n• */gay* - checa se você é gay\n• */help* - envia essa mensagem\n• */privacy* - envia a política de privacidade\n• */random* - escolhe um número aleatório entre 0-10\n• */start* - Inicia o bot\n• */userinfo* - envia algumas informações sobre você\n\n*Veja o código fonte em meu* [repositório no GitHub](https://github.com/lucmsilva651/lynx)*.*\n\nObrigado a todos os usuários, testadores, contribuidores e outros. Sem vocês, talvez esse bot não seria possível ❤️\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,9 +23,9 @@ "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}`", @@ -41,5 +42,14 @@ "provideLocation": "*Por favor, forneça uma localização.*", "invalidLocation": "*Localização inválida. Tente novamente.*", "weatherStatus": "*Clima em {addressFirst}:*\n\n*Estado:* `{getStatusEmoji(iconCode)} {wxPhraseLong}`\n*Temperatura:* `{temperature} °{temperatureUnit}`\n*Sensação térmica:* `{temperatureFeelsLike} °{temperatureUnit2}`\n*Umidade:* `{relativeHumidity}%`\n*Velocidade do vento:* `{windSpeed} {speedUnit}`", - "weatherErr": "*Ocorreu um erro ao obter o clima. Tente novamente mais tarde.*\n\n`{error}`" + "weatherErr": "*Ocorreu um erro ao obter o clima. Tente novamente mais tarde.*\n\n`{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