mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 12:49:57 +00:00
Added additional strings + fixes
This commit is contained in:
parent
4688c4af31
commit
2c1ef7c605
@ -24,12 +24,15 @@ module.exports = (bot) => {
|
|||||||
const userInput = ctx.message.text.split(' ').slice(1).join(' ');
|
const userInput = ctx.message.text.split(' ').slice(1).join(' ');
|
||||||
|
|
||||||
if (!userInput) {
|
if (!userInput) {
|
||||||
ctx.reply('Por favor, forneça o nome do personagem.');
|
ctx.reply(Strings.ponyApiNoCharName, {
|
||||||
|
parse_mode: 'Markdown',
|
||||||
|
reply_to_message_id: ctx.message.message_id
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
const capitalizedInput = capitalizeFirstLetter(userInput);
|
const capitalizedInput = capitalizeFirstLetter(userInput);
|
||||||
const apiUrl = `https://ponyapi.net/v1/character/${capitalizedInput}`;
|
const apiUrl = `http://ponyapi.net/v1/character/${capitalizedInput}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios(apiUrl);
|
const response = await axios(apiUrl);
|
||||||
@ -68,16 +71,15 @@ module.exports = (bot) => {
|
|||||||
reply_to_message_id: ctx.message.message_id
|
reply_to_message_id: ctx.message.message_id
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ctx.reply('Nenhum personagem encontrado.', {
|
ctx.reply(Strings.ponyApiNoCharFound, {
|
||||||
parse_mode: 'Markdown',
|
parse_mode: 'Markdown',
|
||||||
reply_to_message_id: ctx.message.message_id
|
reply_to_message_id: ctx.message.message_id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ctx.reply('Ocorreu um erro ao buscar os dados da API.', {
|
ctx.reply(Strings.ponyApiErr, {
|
||||||
parse_mode: 'Markdown',
|
parse_mode: 'Markdown',
|
||||||
disable_web_page_preview: true,
|
|
||||||
reply_to_message_id: ctx.message.message_id
|
reply_to_message_id: ctx.message.message_id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -88,11 +90,14 @@ module.exports = (bot) => {
|
|||||||
const userInput = ctx.message.text.split(' ').slice(1).join(' ');
|
const userInput = ctx.message.text.split(' ').slice(1).join(' ');
|
||||||
|
|
||||||
if (!userInput) {
|
if (!userInput) {
|
||||||
ctx.reply('Por favor, forneça o nome do personagem.');
|
ctx.reply(Strings.ponyApiNoEpisodeName, {
|
||||||
|
parse_mode: 'Markdown',
|
||||||
|
reply_to_message_id: ctx.message.message_id
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiUrl = `https://ponyapi.net/v1/comics-story/${userInput}`;
|
const apiUrl = `http://ponyapi.net/v1/comics-story/${userInput}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios(apiUrl);
|
const response = await axios(apiUrl);
|
||||||
@ -135,16 +140,15 @@ module.exports = (bot) => {
|
|||||||
reply_to_message_id: ctx.message.message_id
|
reply_to_message_id: ctx.message.message_id
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ctx.reply('Nenhum personagem encontrado.', {
|
ctx.reply(Strings.ponyApiNoEpisodeFound, {
|
||||||
parse_mode: 'Markdown',
|
parse_mode: 'Markdown',
|
||||||
reply_to_message_id: ctx.message.message_id
|
reply_to_message_id: ctx.message.message_id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ctx.reply('Ocorreu um erro ao buscar os dados da API.', {
|
ctx.reply(Strings.ponyApiErr, {
|
||||||
parse_mode: 'Markdown',
|
parse_mode: 'Markdown',
|
||||||
disable_web_page_preview: true,
|
|
||||||
reply_to_message_id: ctx.message.message_id
|
reply_to_message_id: ctx.message.message_id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -85,5 +85,10 @@
|
|||||||
"httpCodeNotFound": "HTTP code not found.",
|
"httpCodeNotFound": "HTTP code not found.",
|
||||||
"httpCodeResult": "*HTTP Code*: {code}\n*Name*: `{message}`\n*Description*: {description}",
|
"httpCodeResult": "*HTTP Code*: {code}\n*Name*: `{message}`\n*Description*: {description}",
|
||||||
"ponyApiCharRes": "*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}`",
|
"ponyApiCharRes": "*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}`",
|
||||||
"ponyApiEpRes": "*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}`"
|
"ponyApiEpRes": "*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}`",
|
||||||
|
"ponyApiNoCharName": "Please provide the character's name.",
|
||||||
|
"ponyApiNoCharFound": "No character found.",
|
||||||
|
"ponyApiNoEpisodeNum": "Please provide the episode's number.",
|
||||||
|
"ponyApiNoEpisodeFound": "No episode found.",
|
||||||
|
"ponyApiErr": "An error occurred while fetching data from the API."
|
||||||
}
|
}
|
@ -85,5 +85,10 @@
|
|||||||
"httpCodeNotFound": "Código HTTP não encontrado.",
|
"httpCodeNotFound": "Código HTTP não encontrado.",
|
||||||
"httpCodeResult": "*Código HTTP*: `{code}`\n*Nome*: `{message}`\n*Descrição*: `{description}`",
|
"httpCodeResult": "*Código HTTP*: `{code}`\n*Nome*: `{message}`\n*Descrição*: `{description}`",
|
||||||
"ponyApiCharRes": "*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}`",
|
"ponyApiCharRes": "*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}`",
|
||||||
"ponyApiEpRes": "*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}`"
|
"ponyApiEpRes": "*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}`",
|
||||||
|
"ponyApiNoCharName": "Por favor, forneça o nome do personagem.",
|
||||||
|
"ponyApiNoCharFound": "Nenhum personagem encontrado.",
|
||||||
|
"ponyApiNoEpisodeNum": "Por favor, forneça o número do episódio.",
|
||||||
|
"ponyApiNoEpisodeFound": "Nenhum episódio encontrado.",
|
||||||
|
"ponyApiErr": "Ocorreu um erro ao buscar dados da API."
|
||||||
}
|
}
|
@ -85,5 +85,10 @@
|
|||||||
"httpCodeNotFound": "Código HTTP no encontrado.",
|
"httpCodeNotFound": "Código HTTP no encontrado.",
|
||||||
"httpCodeResult": "*Código HTTP*: {code}\n*Nombre*: `{message}`\n*Descripción*: {description}",
|
"httpCodeResult": "*Código HTTP*: {code}\n*Nombre*: `{message}`\n*Descripción*: {description}",
|
||||||
"ponyApiCharRes": "*Información del Personaje MLP para* `{input}`*:*\n\n*Nombre:* `{name}`\n*Alias:* `{alias}`\n*URL del Fandom:* [{url}]({url})\n*Sexo:* `{sex}`\n*Residencia:* `{residence}`\n*Ocupación:* `{occupation}`\n*Tipo:* `{kind}`",
|
"ponyApiCharRes": "*Información del Personaje MLP para* `{input}`*:*\n\n*Nombre:* `{name}`\n*Alias:* `{alias}`\n*URL del Fandom:* [{url}]({url})\n*Sexo:* `{sex}`\n*Residencia:* `{residence}`\n*Ocupación:* `{occupation}`\n*Tipo:* `{kind}`",
|
||||||
"ponyApiEpRes": "*Información del Episodio MLP para* `{input}`*:*\n\n*Nombre:* `{name}`\n*URL del Fandom:* [{url}]({url})\n*Temporada:* `{season}`\n*Episodio:* `{episode}`\n*Episodio General:* `{overall}`\n*Fecha de Lanzamiento:* `{airdate}`\n*Historia por:* `{storyby}`\n*Escrito por:* `{writtenby}`\n*Storyboard:* `{storyboard}`"
|
"ponyApiEpRes": "*Información del Episodio MLP para* `{input}`*:*\n\n*Nombre:* `{name}`\n*URL del Fandom:* [{url}]({url})\n*Temporada:* `{season}`\n*Episodio:* `{episode}`\n*Episodio General:* `{overall}`\n*Fecha de Lanzamiento:* `{airdate}`\n*Historia por:* `{storyby}`\n*Escrito por:* `{writtenby}`\n*Storyboard:* `{storyboard}`",
|
||||||
|
"ponyApiNoCharName": "Por favor, proporciona el nombre del personaje.",
|
||||||
|
"ponyApiNoCharFound": "Ningún personaje encontrado.",
|
||||||
|
"ponyApiNoEpisodeNum": "Por favor, proporciona el número del episodio.",
|
||||||
|
"ponyApiNoEpisodeFound": "Ningún episodio encontrado.",
|
||||||
|
"ponyApiErr": "Ocurrió un error al obtener datos de la API."
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user