mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 04:39:57 +00:00
Fixed http.cat command + include it in help
This commit is contained in:
parent
b8067bf59e
commit
1c3c91fa1a
@ -24,22 +24,6 @@ module.exports = (bot) => {
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
};
|
||||
} else if (userInput && userInput.includes("http")) {
|
||||
request = `/${userInput.replace("http", "")}`;
|
||||
const apiUrl = `https://http.cat${request}`;
|
||||
|
||||
try {
|
||||
await ctx.replyWithPhoto(apiUrl, {
|
||||
caption: `🐱`,
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
} catch (error) {
|
||||
ctx.reply(Strings.catImgErr, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
};
|
||||
} else {
|
||||
request = userInput ? `/${userInput}` : '';
|
||||
const apiUrl = `https://cataas.com/cat${request}`;
|
||||
@ -58,4 +42,31 @@ module.exports = (bot) => {
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
bot.command("httpcat", spamwatchMiddleware, async (ctx) => {
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
const userInput = ctx.message.text.split(' ').slice(1).join(' ').replace(/\s+/g, '');
|
||||
|
||||
if (!userInput || isNaN(userInput)) {
|
||||
return ctx.reply(Strings.catImgErr, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
}
|
||||
|
||||
const apiUrl = `https://http.cat/${userInput}`;
|
||||
|
||||
try {
|
||||
await ctx.replyWithPhoto(apiUrl, {
|
||||
caption: `🐱 ${apiUrl}`,
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
} catch (error) {
|
||||
ctx.reply(Strings.catImgErr, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -8,9 +8,10 @@ async function sendHelpMessage(ctx, isEditing) {
|
||||
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' }],
|
||||
[{ text: Strings.lastFm, callback_data: '5' }, { text: Strings.ytDlp, callback_data: '6' }]
|
||||
[{ text: Strings.mainCommands, callback_data: 'helpMain' }, { text: Strings.usefulCommands, callback_data: 'helpUseful' }],
|
||||
[{ text: Strings.interactiveEmojis, callback_data: 'helpInteractive' }, { text: Strings.funnyCommands, callback_data: 'helpFunny' }],
|
||||
[{ text: Strings.lastFm, callback_data: 'helpLast' }, { text: Strings.animalCommands, callback_data: 'helpAnimals' }],
|
||||
[{ text: Strings.ytDlp, callback_data: 'helpYouTube' }]
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -35,37 +36,41 @@ module.exports = (bot) => {
|
||||
disable_web_page_preview: true,
|
||||
reply_markup: JSON.stringify({
|
||||
inline_keyboard: [
|
||||
[{ text: Strings.goBack, callback_data: '7' }],
|
||||
[{ text: Strings.goBack, callback_data: 'helpBack' }],
|
||||
]
|
||||
})
|
||||
};
|
||||
|
||||
switch (callbackData) {
|
||||
case '1':
|
||||
case 'helpMain':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.mainCommandsDesc, options);
|
||||
break;
|
||||
case '2':
|
||||
case 'helpUseful':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.usefulCommandsDesc, options);
|
||||
break;
|
||||
case '3':
|
||||
case 'helpInteractive':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.interactiveEmojisDesc, options);
|
||||
break;
|
||||
case '4':
|
||||
case 'helpFunny':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.funnyCommandsDesc, options);
|
||||
break;
|
||||
case '5':
|
||||
case 'helpLast':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.lastFmDesc, options);
|
||||
break;
|
||||
case '6':
|
||||
case 'helpYouTube':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.ytDlpDesc, options);
|
||||
break;
|
||||
case '7':
|
||||
case 'helpAnimals':
|
||||
await ctx.answerCbQuery();
|
||||
await ctx.editMessageText(Strings.animalCommandsDesc, options);
|
||||
break;
|
||||
case 'helpBack':
|
||||
await ctx.answerCbQuery();
|
||||
await sendHelpMessage(ctx, true);
|
||||
break;
|
||||
|
@ -31,8 +31,6 @@
|
||||
"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 neither!",
|
||||
"gifErr": "*Something went wrong while sending the GIF. Please try again later.*\n\n{err}",
|
||||
"lastFm": "Last.fm",
|
||||
"lastFmDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Shows the last song from your Last.fm profile + the number of plays.\n- /setuser `<user>`: Sets the user for the command above.",
|
||||
"lastFmNoUser": "*Please provide a Last.fm username.*\nExample: `/setuser <username>`",
|
||||
"lastFmNoSet": "*You haven't set your Last.fm username yet.*\nUse the command /setuser to set.\n\nExample: `/setuser <username>`",
|
||||
"lastFmNoRecent": "*No recent tracks found for Last.fm user* `{lastfmUser}`*.*",
|
||||
@ -52,11 +50,15 @@
|
||||
"usefulCommands": "Useful commands",
|
||||
"usefulCommandsDesc": "*Useful commands*\n\n- /chatinfo: Send information about the group\n- /userinfo: Send information about yourself\n- /d | /device `<model>`: Search for a device on GSMArena and show its specs.\n- /weather | /clima `<city>`: See weather status for a specific location.\n- /modarchive | /tma `<module id>`: Download a module from The Mod Archive.\n- /wiki <wiki page> (WIP): Displays content from a Wikipedia page, converting some things to a more familiar format on Telegram.",
|
||||
"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\n- /soggy `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Sends the [Soggy cat meme](https://knowyourmeme.com/memes/soggy-cat)\n - /cat `<tags>` - Sends a random picture of a cat. You can specify some tags, separating each by a comma. Example: `/cat orange, cute`\n - /dog - Sends a random picture of a dog.",
|
||||
"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!",
|
||||
"ytDlp": "yt-dlp (YouTube)",
|
||||
"ytDlpDesc": "*yt-dlp (YouTube)*\n\n- /yt | /ytdl `<video link>`: Download an YouTube video\n\nThis command also works with other video platforms! See [this link](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) for more information and which services are supported.\n\n*Note: Telegram is currently limiting bot uploads to 50MB, which means that if the video you want to download is larger than 50MB, the quality will be reduced to try to upload it anyway. We're trying our best to work around or fix this problem.*",
|
||||
"lastFm": "Last.fm",
|
||||
"lastFmDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Shows the last song from your Last.fm profile + the number of plays.\n- /setuser `<user>`: Sets the user for the command above.",
|
||||
"animalCommands": "Animals",
|
||||
"animalCommandsDesc": "*Animals*\n\n- /soggy `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Sends the [Soggy cat meme](https://knowyourmeme.com/memes/soggy-cat)\n - /cat `<tags>`: Sends a random picture of a cat. You can specify some tags, separating each by a comma. Example: `/cat orange, cute`\n- /dog: Sends a random picture of a dog.\n- /httpcat `<http code>`: Send cat memes from http.cat with your specified HTTP code. Example: `/httpcat 404`",
|
||||
"goBack": "Back",
|
||||
"maInvalidModule": "Please provide a valid module ID from The Mod Archive.\nExample: `/modarchive 81574`",
|
||||
"maDownloadError": "Error downloading the file. Check the module ID and try again.",
|
||||
|
@ -31,8 +31,6 @@
|
||||
"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}",
|
||||
"lastFm": "Last.fm",
|
||||
"lastFmDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Mostra a última música do seu perfil no Last.fm + o número de reproduções.\n- /setuser `<usuário>`: Define o usuário para o comando acima.",
|
||||
"lastFmNoUser": "*Por favor, forneça um nome de usuário do Last.fm.*\nExemplo: `/setuser <username>`",
|
||||
"lastFmNoSet": "*Você ainda não definiu seu nome de usuário do Last.fm.*\nUse o comando /setuser para definir.\n\nExemplo: `/setuser <username>`",
|
||||
"lastFmNoRecent": "*Nenhuma faixa recente encontrada para o usuário do Last.fm* `{lastfmUser}`*.*",
|
||||
@ -52,11 +50,15 @@
|
||||
"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 `<modelo>`: Pesquisa um dispositivo no GSMArena e mostra suas especificações.\n- /weather | /clima `<cidade>`: Veja o status do clima para uma localização específica\n- /modarchive | /tma `<id do módulo>`: Baixa um módulo do The Mod Archive.\n- /wiki <página da wiki> (WIP): Exibe conteúdo de uma página da Wikipedia, convertendo algumas coisas para um formato mais familiar no Telegram.",
|
||||
"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\n- /soggy `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Envia o meme [Soggy cat](https://knowyourmeme.com/memes/soggy-cat)\n- /cat `<tags>` - Envia uma foto aleatória de um gato. Você pode especificar algumas tags em inglês, separando cada uma por uma vírgula. Exemplo: `/cat orange, cute`\n- /dog - Envia uma imagem aleatória de um cachorro.",
|
||||
"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!",
|
||||
"ytDlp": "yt-dlp (YouTube)",
|
||||
"ytDlpDesc": "*yt-dlp (YouTube)*\n\n- /yt | /ytdl `<link do vídeo>`: Baixa um vídeo do YouTube.\n\nEsse comando também funciona com outras plataformas de vídeo! Consulte [este link](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) para obter mais informações e saber quais serviços são compatíveis.\n\n*Nota: O Telegram está atualmente limitando os uploads de bots a 50MB, o que significa que se o vídeo que você deseja baixar for maior que 50MB, a qualidade será reduzida para tentar carregá-lo de qualquer maneira. Estamos fazendo o possível para contornar ou corrigir esse problema.*",
|
||||
"lastFm": "Last.fm",
|
||||
"lastFmDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Mostra a última música do seu perfil no Last.fm + o número de reproduções.\n- /setuser `<usuário>`: Define o usuário para o comando acima.",
|
||||
"animalCommands": "Animais",
|
||||
"animalCommandsDesc": "*Animais*\n\n- /soggy `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Envia o [meme do gato encharcado](https://knowyourmeme.com/memes/soggy-cat)\n- /cat `<tags>` - Envia uma foto aleatória de um gato. Você pode especificar algumas tags em inglês, separando cada uma por uma vírgula. Exemplo: `/cat orange, cute`\n- /dog - Envia uma imagem aleatória de um cachorro.\n- /httpcat `<código http>`: Envia memes de gato do http.cat com o código HTTP especificado. Exemplo: `/httpcat 404`",
|
||||
"goBack": "Voltar",
|
||||
"maInvalidModule": "Por favor, forneça um ID de módulo válido do The Mod Archive.\nExemplo: `/modarchive 81574`",
|
||||
"maDownloadError": "Erro ao baixar o arquivo. Verifique o ID do módulo e tente novamente.",
|
||||
|
@ -31,8 +31,6 @@
|
||||
"chatInfo": "*Información del chat*\n\n*Nombre:* `{chatName}`\n*ID del chat:* `{chatId}`\n*Identificador:* `{chatHandle}`\n*Tipo:* `{chatType}`\n*Membros:* `{chatMembersCount}`\n*Es un foro:* `{isForum}`",
|
||||
"funEmojiResult": "*Lanzaste {emoji} y obtuviste *`{value}`*!*\n¿No sabes lo que significa? ¡Yo tampoco!",
|
||||
"gifErr": "*Algo salió mal al enviar el GIF. Inténtalo de nuevo más tarde.*\n\n{err}",
|
||||
"lastFm": "Last.fm",
|
||||
"lastFmDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Muestra la última canción de tu perfil en Last.fm + el número de reproducciones.\n- /setuser `<usuario>`: Define el usuario para el comando anterior.",
|
||||
"lastFmNoUser": "*Por favor, proporciona un nombre de usuario de Last.fm.*\nEjemplo: `/setuser <username>`",
|
||||
"lastFmNoSet": "*Aún no has definido tu nombre de usuario de Last.fm.*\nUsa el comando /setuser para definirlo.\n\nEjemplo: `/setuser <username>`",
|
||||
"lastFmNoRecent": "*No se encontró ninguna pista reciente para el usuario de Last.fm* `{lastfmUser}`*.*",
|
||||
@ -52,11 +50,15 @@
|
||||
"usefulCommands": "Comandos útiles",
|
||||
"usefulCommandsDesc": "*Comandos útiles*\n\n- /chatinfo: Envía información sobre el grupo\n- /userinfo: Envía información sobre ti\n- /d | /device `<modelo>`: Busca un dispositivo en GSMArena y muestra sus especificaciones.\n- /weather | /clima `<ciudad>`: Ve el estado del clima para una ubicación específica\n- /modarchive | /tma `<id del módulo>`: Descarga un módulo del The Mod Archive.\n- /wiki <página de la wiki> (WIP): Muestra contenido de una página de Wikipedia, convirtiendo algunas cosas a un formato más familiar en Telegram.",
|
||||
"funnyCommands": "Comandos graciosos",
|
||||
"funnyCommandsDesc": "*Comandos graciosos*\n\n- /gay: Verifica si eres gay\n- /furry: Verifica si eres furry\n- /random: Elige un número aleatorio entre 0-10\n- /soggy `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Envía el meme [Soggy cat](https://knowyourmeme.com/memes/soggy-cat)\n- /cat `<tags>` - Envía una foto aleatoria de un gato. Puedes especificar algunas etiquetas en inglés, separando cada una por una coma. Ejemplo: `/cat orange, cute`\n- /dog - Envía una foto aleatoria de un perro.",
|
||||
"funnyCommandsDesc": "*Comandos graciosos*\n\n- /gay: Verifica si eres gay\n- /furry: Verifica si eres furry\n- /random: Elige un número aleatorio entre 0-10",
|
||||
"interactiveEmojis": "Emojis interactivos",
|
||||
"interactiveEmojisDesc": "*Emojis interactivos*\n\n- /dice: Tira un dado\n- /idice: Lanza infinitamente un dado de colores\n- /slot: ¡Intenta combinar las figuras!\n- /ball: ¡Intenta chutar la bola al gol!\n- /bowling: ¡Intenta derribar los bolos!\n- /dart: ¡Intenta acertar en el blanco!",
|
||||
"ytDlp": "yt-dlp (YouTube)",
|
||||
"ytDlpDesc": "*yt-dlp (YouTube)*\n\n- /yt | /ytdl `<enlace del video>`: Descarga un video de YouTube.\n\n¡Este comando también funciona con otras plataformas de video! Consulta [este enlace](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) para obtener más información y saber qué servicios son compatibles.\n\n*Nota: Telegram actualmente limita las cargas de bots a 50 MB, lo que significa que si el video que deseas descargar es mayor de 50 MB, la calidad se reducirá para intentar cargarlo de todos modos. Estamos haciendo todo lo posible para sortear o corregir este problema.*",
|
||||
"lastFm": "Last.fm",
|
||||
"lastFmDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Muestra la última canción de tu perfil en Last.fm + el número de reproducciones.\n- /setuser `<usuario>`: Define el usuario para el comando anterior.",
|
||||
"animalCommands": "Animales",
|
||||
"animalCommandsDesc": "*Animales*\n\n- /soggy `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Envía el [meme del gato empapado](https://knowyourmeme.com/memes/soggy-cat)\n- /cat `<tags>` - Envía una foto aleatoria de un gato. Puedes especificar algunas tags en inglés, separando cada una por una coma. Ejemplo: `/cat orange, cute`\n- /dog - Envía una foto aleatoria de un perro.\n- /httpcat `<código http>`: Envía memes de gato de http.cat con tu código HTTP especificado. Ejemplo: `/httpcat 404`",
|
||||
"goBack": "Volver",
|
||||
"maInvalidModule": "Por favor, proporciona un ID de módulo válido del The Mod Archive.\nEjemplo: `/modarchive 81574`",
|
||||
"maDownloadError": "Error al descargar el archivo. Verifica el ID del módulo e inténtalo de nuevo.",
|
||||
|
Loading…
x
Reference in New Issue
Block a user