mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 04:39:57 +00:00
✨ feat: Buttons for help
This commit is contained in:
parent
2f1997a4d0
commit
dadbf02e9e
@ -3,6 +3,25 @@ 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.information, callback_data: '1' }, { text: Strings.check, callback_data: '2' }],
|
||||
[{ text: Strings.intemojis, callback_data: '3' }, { text: Strings.botinfo, 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);
|
||||
@ -16,14 +35,42 @@ module.exports = (bot) => {
|
||||
});
|
||||
|
||||
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 = {reply_markup: JSON.stringify({
|
||||
inline_keyboard: [
|
||||
[{ text: String.goback, callback_data: '5' }],
|
||||
]})
|
||||
};
|
||||
switch (callbackData) {
|
||||
case '1':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.informationHelp, options);
|
||||
break;
|
||||
case '2':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.funnyChecksHelp, options);
|
||||
break;
|
||||
case '3':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.interactiveEmojisHelp, options);
|
||||
break;
|
||||
case '4':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.botinfo, options);
|
||||
break;
|
||||
case '5':
|
||||
await ctx.answerCbQuery();
|
||||
await sendHelpMessage(ctx, true);
|
||||
break;
|
||||
default:
|
||||
await ctx.answerCbQuery('Woops! Invalid option');
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
bot.command('privacy', spamwatchMiddleware, async (ctx) => {
|
||||
|
@ -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*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!*",
|
||||
"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.",
|
||||
"unKnown": "Unknown",
|
||||
"varYes": "Yes",
|
||||
@ -37,5 +37,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}"
|
||||
"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"
|
||||
}
|
||||
|
@ -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*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!*",
|
||||
"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.",
|
||||
"unKnown": "Desconhecido",
|
||||
"varYes": "Sim",
|
||||
@ -37,5 +37,14 @@
|
||||
"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}.",
|
||||
"currentCommit": "*Commit atual:* `{commitHash}`",
|
||||
"errorRetrievingCommit": "*Erro ao obter o commit:* {error}"
|
||||
"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"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user