Unnecessary split code removed + update swlib commit

Signed-off-by: lucmsilva651 <lucmsilva651@gmail.com>
This commit is contained in:
Lucas Gabriel 2024-08-31 21:23:30 -03:00
parent 96f915838d
commit 4be9aa4aca
No known key found for this signature in database
GPG Key ID: D9B075FC6DC93985
9 changed files with 52 additions and 60 deletions

View File

@ -45,7 +45,24 @@ async function handleDiceCommand(ctx, emoji, delay) {
}, delay); }, delay);
} }
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
module.exports = (bot) => { 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) => { bot.command('dice', spamwatchMiddleware, async (ctx) => {
await handleDiceCommand(ctx, undefined, 4000); await handleDiceCommand(ctx, undefined, 4000);
}); });
@ -58,6 +75,14 @@ module.exports = (bot) => {
await handleDiceCommand(ctx, '⚽', 3000); 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) => { bot.command('idice', spamwatchMiddleware, async (ctx) => {
const stickerId = "CAACAgQAAxkBAAJxjWbSSP-8ZNEhEpAJjQsHsGf-UuEPAAJCAAPI-uwTAAEBVWWh4ucINQQ"; const stickerId = "CAACAgQAAxkBAAJxjWbSSP-8ZNEhEpAJjQsHsGf-UuEPAAJCAAPI-uwTAAEBVWWh4ucINQQ";
ctx.replyWithSticker(stickerId, { ctx.replyWithSticker(stickerId, {

View File

@ -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
}
);
});
};

View File

@ -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
}
);
});
}; };

View File

@ -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
}
);
});
};

View File

@ -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
}
);
});
};

View File

@ -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!", "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.", "lynxPrivacy": "Check out [this link](https://blog.eleu.me/posts/lynx-privacy-policy) to read the bot privacy policy.",
"unKnown": "Unknown", "unKnown": "Unknown",
"varYes": "Yes", "varYes": "Yes",
@ -24,7 +24,7 @@
"isNtGay": "Aahhh. You are not gay!", "isNtGay": "Aahhh. You are not gay!",
"isFurry": "Yes, you are *furry*!", "isFurry": "Yes, you are *furry*!",
"isNtFurry": "Aahhh. You are not a 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}`", "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}`", "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 too!",

View File

@ -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.", "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.", "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", "unKnown": "Desconhecido",
"varYes": "Sim", "varYes": "Sim",
@ -24,7 +24,7 @@
"isNtGay": "Aahhh. Você não é gay!", "isNtGay": "Aahhh. Você não é gay!",
"isFurry": "Sim, você é *furry*!", "isFurry": "Sim, você é *furry*!",
"isNtFurry": "Aahhh. Você não é um 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}`", "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}`", "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!", "funEmojiResult": "*Você lançou {emoji} e obteve *`{value}`*!*\nVocê não sabe o que isso significa? Nem eu!",

@ -1 +1 @@
Subproject commit 8fe6dce44de50cdb24c2cec13d93c5662b0396ec Subproject commit f0efeb63c414636d5ed523250d007f2b2248c583