mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 04:39:57 +00:00
Put all strings of /http and /httpcat on another JSON object
This commit is contained in:
parent
e6fec9abe8
commit
39f22ccf96
@ -10,7 +10,7 @@ module.exports = (bot) => {
|
||||
const apiUrl = "https://status.js.org/codes.json";
|
||||
|
||||
if (!userInput || isNaN(userInput)) {
|
||||
return ctx.reply(Strings.httpCodeInvalid, {
|
||||
return ctx.reply(Strings.httpCodes.invalidCode, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
@ -23,7 +23,7 @@ module.exports = (bot) => {
|
||||
const codeInfo = codesArray.find(item => item.code === parseInt(userInput));
|
||||
|
||||
if (codeInfo) {
|
||||
const message = Strings.httpCodeResult
|
||||
const message = Strings.httpCodes.resultMsg
|
||||
.replace("{code}", codeInfo.code)
|
||||
.replace("{message}", codeInfo.message)
|
||||
.replace("{description}", codeInfo.description);
|
||||
@ -32,13 +32,13 @@ module.exports = (bot) => {
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
} else {
|
||||
await ctx.reply(Strings.httpCodeNotFound, {
|
||||
await ctx.reply(Strings.httpCodes.notFound, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
};
|
||||
} catch (error) {
|
||||
const message = Strings.httpCodeErr.replace("{error}", error);
|
||||
const message = Strings.httpCodes.fetchErr.replace("{error}", error);
|
||||
ctx.reply(message, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
@ -51,7 +51,7 @@ module.exports = (bot) => {
|
||||
const userInput = ctx.message.text.split(' ').slice(1).join(' ').replace(/\s+/g, '');
|
||||
|
||||
if (!userInput || isNaN(userInput)) {
|
||||
return ctx.reply(Strings.catImgErr, {
|
||||
return ctx.reply(Strings.httpCodes.invalidCode, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
|
@ -86,10 +86,12 @@
|
||||
"quoteResult": "Here is a random quote for you:",
|
||||
"quoteErr": "Sorry, but something went wrong while displaying the quote.",
|
||||
"dogImgErr": "Sorry, but I couldn't get the dog photo you wanted.",
|
||||
"httpCodeInvalid": "Please enter a valid HTTP code.",
|
||||
"httpCodeErr": "An error occurred while fetching the HTTP code.",
|
||||
"httpCodeNotFound": "HTTP code not found.",
|
||||
"httpCodeResult": "*HTTP Code*: {code}\n*Name*: `{message}`\n*Description*: {description}",
|
||||
"httpCodes": {
|
||||
"invalidCode": "Please enter a valid HTTP code.",
|
||||
"fetchErr": "An error occurred while fetching the HTTP code.",
|
||||
"notFound": "HTTP code not found.",
|
||||
"resultMsg": "*HTTP Code*: {code}\n*Name*: `{message}`\n*Description*: {description}"
|
||||
},
|
||||
"ponyApi": {
|
||||
"charRes": "*MLP Character Information for* \"`{input}`\"*:*\n\n*Name:* `{name}`\n*Alias*: `{alias}`\n*Fandom URL:* [{url}]({url})\n*Sex:* `{sex}`\n*Residence:* `{residence}`\n*Occupation:* `{occupation}`\n*Kind:* `{kind}`",
|
||||
"epRes": "*MLP Episode Information for* \"`{input}`\"*:*\n\n*Name:* `{name}`\n*Fandom URL:* [{url}]({url})\n*Season:* `{season}`\n*Episode:* `{episode}`\n*Overall Ep.:* `{overall}`\n*Release date:* `{airdate}`\n*Story by:* `{storyby}`\n*Written by:* `{writtenby}`\n*Storyboard:* `{storyboard}`",
|
||||
|
@ -86,10 +86,12 @@
|
||||
"quoteResult": "Aqui está uma citação aleatória pra você (em inglês):",
|
||||
"quoteErr": "Desculpe, mas algo deu errado ao exibir a citação.",
|
||||
"dogImgErr": "Desculpe, mas não consegui obter a foto do cacbhorro que você queria.",
|
||||
"httpCodeInvalid": "Por favor, insira um código HTTP válido.",
|
||||
"httpCodeErr": "Ocorreu um erro ao buscar o código HTTP.",
|
||||
"httpCodeNotFound": "Código HTTP não encontrado.",
|
||||
"httpCodeResult": "*Código HTTP*: `{code}`\n*Nome*: `{message}`\n*Descrição*: `{description}`",
|
||||
"httpCodes": {
|
||||
"invalidCode": "Por favor, insira um código HTTP válido.",
|
||||
"fetchErr": "Ocorreu um erro ao buscar o código HTTP.",
|
||||
"notFound": "Código HTTP não encontrado.",
|
||||
"resultMsg": "*Código HTTP*: `{code}`\n*Nome*: `{message}`\n*Descrição*: `{description}`"
|
||||
},
|
||||
"ponyApi": {
|
||||
"charRes": "*Informações do Personagem de MLP para* `{input}`*:*\n\n*Nome:* `{name}`\n*Apelido:* `{alias}`\n*URL do Fandom:* [{url}]({url})\n*Sexo:* `{sex}`\n*Residência:* `{residence}`\n*Ocupação:* `{occupation}`\n*Tipo:* `{kind}`",
|
||||
"epRes": "*Informações do Episódio de MLP para* `{input}`*:*\n\n*Nome:* `{name}`\n*URL do Fandom:* [{url}]({url})\n*Temporada:* `{season}`\n*Episódio:* `{episode}`\n*Episódio Geral:* `{overall}`\n*Data de Lançamento:* `{airdate}`\n*História por:* `{storyby}`\n*Escrito por:* `{writtenby}`\n*Storyboard:* `{storyboard}`",
|
||||
|
Loading…
x
Reference in New Issue
Block a user