diff --git a/commands/fun.js b/commands/fun.js index 975afe4..3852f18 100644 --- a/commands/fun.js +++ b/commands/fun.js @@ -45,7 +45,24 @@ async function handleDiceCommand(ctx, emoji, delay) { }, delay); } +function getRandomInt(max) { + return Math.floor(Math.random() * max); +} + module.exports = (bot) => { + bot.command('random', spamwatchMiddleware, async (ctx) => { + const Strings = getStrings(ctx.from.language_code); + const randomValue = getRandomInt(11); + const randomVStr = Strings.randomNum.replace('{number}', randomValue); + + ctx.reply( + randomVStr, { + parse_mode: 'Markdown', + reply_to_message_id: ctx.message.message_id + } + ); + }); + bot.command('dice', spamwatchMiddleware, async (ctx) => { await handleDiceCommand(ctx, undefined, 4000); }); @@ -58,6 +75,14 @@ module.exports = (bot) => { await handleDiceCommand(ctx, '⚽', 3000); }); + bot.command('dart', spamwatchMiddleware, async (ctx) => { + await handleDiceCommand(ctx, '🎯', 3000); + }); + + bot.command('bowling', spamwatchMiddleware, async (ctx) => { + await handleDiceCommand(ctx, '🎳', 3000); + }); + bot.command('idice', spamwatchMiddleware, async (ctx) => { const stickerId = "CAACAgQAAxkBAAJxjWbSSP-8ZNEhEpAJjQsHsGf-UuEPAAJCAAPI-uwTAAEBVWWh4ucINQQ"; ctx.replyWithSticker(stickerId, { diff --git a/commands/help.js b/commands/help.js deleted file mode 100644 index 09c703c..0000000 --- a/commands/help.js +++ /dev/null @@ -1,17 +0,0 @@ -const { getStrings } = require('../plugins/checklang.js'); -const resources = require('../props/resources.json'); -const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js'); -const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch); - -module.exports = (bot) => { - bot.help(spamwatchMiddleware, async (ctx) => { - 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 - } - ); - }); -}; \ No newline at end of file diff --git a/commands/getinfo.js b/commands/info.js similarity index 100% rename from commands/getinfo.js rename to commands/info.js diff --git a/commands/start.js b/commands/main.js similarity index 50% rename from commands/start.js rename to commands/main.js index ab8d9a9..874840f 100644 --- a/commands/start.js +++ b/commands/main.js @@ -14,4 +14,26 @@ module.exports = (bot) => { } ); }); + + bot.help(spamwatchMiddleware, async (ctx) => { + 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 + } + ); + }); + + 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 + } + ); + }); }; \ No newline at end of file diff --git a/commands/privacy.js b/commands/privacy.js deleted file mode 100644 index e439558..0000000 --- a/commands/privacy.js +++ /dev/null @@ -1,16 +0,0 @@ -const { getStrings } = require('../plugins/checklang.js'); -const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js'); -const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch); - -module.exports = (bot) => { - 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 - } - ); - }); -}; \ No newline at end of file diff --git a/commands/random.js b/commands/random.js deleted file mode 100644 index 750dbc2..0000000 --- a/commands/random.js +++ /dev/null @@ -1,22 +0,0 @@ -const { getStrings } = require('../plugins/checklang.js'); -const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js'); -const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch); - -function getRandomInt(max) { - return Math.floor(Math.random() * max); -} - -module.exports = (bot) => { - bot.command('random', spamwatchMiddleware, async (ctx) => { - const Strings = getStrings(ctx.from.language_code); - const randomValue = getRandomInt(11); - const randomVStr = Strings.randomNum.replace('{number}', randomValue); - - ctx.reply( - randomVStr, { - parse_mode: 'Markdown', - 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 c2fd887..9cae45d 100644 --- a/locales/english.json +++ b/locales/english.json @@ -1,6 +1,6 @@ { "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*Cat pictures (profile photo/help):* [@monkeycatluna](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!*", + "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.", "unKnown": "Unknown", "varYes": "Yes", @@ -24,7 +24,7 @@ "isNtGay": "Aahhh. You are not gay!", "isFurry": "Yes, you are *furry*!", "isNtFurry": "Aahhh. You are not a furry!", - "randomNum": "*Generated number (0-10):* `{number}.`", + "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!", diff --git a/locales/portuguese.json b/locales/portuguese.json index 00f2f8c..b776772 100644 --- a/locales/portuguese.json +++ b/locales/portuguese.json @@ -1,6 +1,6 @@ { "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*Fotos do gato (foto de perfil/ajuda):* [@monkeycatluna](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!*", + "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.", "unKnown": "Desconhecido", "varYes": "Sim", @@ -24,7 +24,7 @@ "isNtGay": "Aahhh. Você não é gay!", "isFurry": "Sim, você é *furry*!", "isNtFurry": "Aahhh. Você não é um furry!", - "randomNum": "*Número gerado (0-10):* `{number}.`", + "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!", diff --git a/plugins/lib-spamwatch b/plugins/lib-spamwatch index 8fe6dce..f0efeb6 160000 --- a/plugins/lib-spamwatch +++ b/plugins/lib-spamwatch @@ -1 +1 @@ -Subproject commit 8fe6dce44de50cdb24c2cec13d93c5662b0396ec +Subproject commit f0efeb63c414636d5ed523250d007f2b2248c583