mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-04-28 17:15:57 +00:00
Merge Kowalski with TwilightSparkle + fixes/changes
This commit is contained in:
parent
867a1f8a66
commit
3d125ffbf9
@ -27,7 +27,7 @@ module.exports = (bot) => {
|
||||
|
||||
if (verifyInput(ctx, userInput, noCharName)) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const capitalizedInput = capitalizeFirstLetter(userInput);
|
||||
const apiUrl = `${Resources.ponyApi}/character/${capitalizedInput}`;
|
||||
@ -48,13 +48,14 @@ module.exports = (bot) => {
|
||||
}
|
||||
|
||||
charactersArray.push({
|
||||
id: character.id,
|
||||
name: character.name,
|
||||
alias: aliases.length > 0 ? aliases.join(', ') : 'N/A',
|
||||
alias: aliases.length > 0 ? aliases.join(', ') : 'None',
|
||||
url: character.url,
|
||||
sex: character.sex,
|
||||
residence: character.residence ? character.residence.replace(/\n/g, ' / ') : 'N/A',
|
||||
occupation: character.occupation ? character.occupation.replace(/\n/g, ' / ') : 'N/A',
|
||||
kind: character.kind ? character.kind.join(', ') : 'N/A',
|
||||
residence: character.residence ? character.residence.replace(/\n/g, ' / ') : 'None',
|
||||
occupation: character.occupation ? character.occupation.replace(/\n/g, ' / ') : 'None',
|
||||
kind: character.kind ? character.kind.join(', ') : 'None',
|
||||
image: character.image
|
||||
});
|
||||
});
|
||||
@ -62,7 +63,7 @@ module.exports = (bot) => {
|
||||
|
||||
if (charactersArray.length > 0) {
|
||||
const result = Strings.ponyApi.charRes
|
||||
.replace("{input}", userInput)
|
||||
.replace("{id}", charactersArray[0].id)
|
||||
.replace("{name}", charactersArray[0].name)
|
||||
.replace("{alias}", charactersArray[0].alias)
|
||||
.replace("{url}", charactersArray[0].url)
|
||||
@ -100,7 +101,7 @@ module.exports = (bot) => {
|
||||
|
||||
if (verifyInput(ctx, userInput, noEpisodeNum, true)) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const apiUrl = `${Resources.ponyApi}/episode/by-overall/${userInput}`;
|
||||
|
||||
@ -111,6 +112,7 @@ module.exports = (bot) => {
|
||||
if (Array.isArray(response.data.data)) {
|
||||
response.data.data.forEach(episode => {
|
||||
episodeArray.push({
|
||||
id: episode.id,
|
||||
name: episode.name,
|
||||
image: episode.image,
|
||||
url: episode.url,
|
||||
@ -118,16 +120,16 @@ module.exports = (bot) => {
|
||||
episode: episode.episode,
|
||||
overall: episode.overall,
|
||||
airdate: episode.airdate,
|
||||
storyby: episode.storyby ? episode.storyby.replace(/\n/g, ' / ') : 'N/A',
|
||||
writtenby: episode.writtenby ? episode.writtenby.replace(/\n/g, ' / ') : 'N/A',
|
||||
storyboard: episode.storyboard ? episode.storyboard.replace(/\n/g, ' / ') : 'N/A',
|
||||
storyby: episode.storyby ? episode.storyby.replace(/\n/g, ' / ') : 'None',
|
||||
writtenby: episode.writtenby ? episode.writtenby.replace(/\n/g, ' / ') : 'None',
|
||||
storyboard: episode.storyboard ? episode.storyboard.replace(/\n/g, ' / ') : 'None',
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
if (episodeArray.length > 0) {
|
||||
const result = Strings.ponyApi.epRes
|
||||
.replace("{input}", userInput)
|
||||
.replace("{id}", episodeArray[0].id)
|
||||
.replace("{name}", episodeArray[0].name)
|
||||
.replace("{url}", episodeArray[0].url)
|
||||
.replace("{season}", episodeArray[0].season)
|
||||
@ -178,14 +180,15 @@ module.exports = (bot) => {
|
||||
if (Array.isArray(response.data.data)) {
|
||||
response.data.data.forEach(comic => {
|
||||
comicArray.push({
|
||||
id: comic.id,
|
||||
name: comic.name,
|
||||
series: comic.series,
|
||||
image: comic.image,
|
||||
url: comic.url,
|
||||
writer: comic.writer ? comic.writer.replace(/\n/g, ' / ') : 'N/A',
|
||||
artist: comic.artist ? comic.artist.replace(/\n/g, ' / ') : 'N/A',
|
||||
colorist: comic.colorist ? comic.colorist.replace(/\n/g, ' / ') : 'N/A',
|
||||
letterer: comic.letterer ? comic.letterer.replace(/\n/g, ' / ') : 'N/A',
|
||||
writer: comic.writer ? comic.writer.replace(/\n/g, ' / ') : 'None',
|
||||
artist: comic.artist ? comic.artist.replace(/\n/g, ' / ') : 'None',
|
||||
colorist: comic.colorist ? comic.colorist.replace(/\n/g, ' / ') : 'None',
|
||||
letterer: comic.letterer ? comic.letterer.replace(/\n/g, ' / ') : 'None',
|
||||
editor: comic.editor
|
||||
});
|
||||
});
|
||||
@ -193,7 +196,7 @@ module.exports = (bot) => {
|
||||
|
||||
if (comicArray.length > 0) {
|
||||
const result = Strings.ponyApi.comicRes
|
||||
.replace("{input}", userInput)
|
||||
.replace("{id}", comicArray[0].id)
|
||||
.replace("{name}", comicArray[0].name)
|
||||
.replace("{series}", comicArray[0].series)
|
||||
.replace("{url}", comicArray[0].url)
|
||||
|
@ -5,7 +5,7 @@ const spamwatchMiddleware = require('../spamwatch/Middleware.js')(isOnSpamWatch)
|
||||
const axios = require("axios");
|
||||
|
||||
module.exports = (bot) => {
|
||||
bot.command(["rpony", "randompony"], spamwatchMiddleware, async (ctx) => {
|
||||
bot.command(["rpony", "randompony", "mlpart"], spamwatchMiddleware, async (ctx) => {
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
try {
|
||||
const response = await axios(Resources.randomPonyApi);
|
||||
@ -20,7 +20,7 @@ module.exports = (bot) => {
|
||||
}
|
||||
|
||||
ctx.replyWithPhoto(response.data.pony.representations.full, {
|
||||
caption: `${response.data.pony.sourceURL}\n\n${tags.length > 0 ? tags.join(', ') : 'N/A'}`,
|
||||
caption: `${response.data.pony.sourceURL}\n\n${tags.length > 0 ? tags.join(', ') : ''}`,
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
|
@ -95,9 +95,9 @@
|
||||
"ponyApi": {
|
||||
"helpEntry": "My Little Pony",
|
||||
"helpDesc": "*My Little Pony*\n\n- /mlp: Displays this help message.\n- /mlpchar `<character name>`: Shows specific information about a My Little Pony character. Example: `/mlpchar Twilight Sparkle`\n- /mlpep: Shows specific information about a My Little Pony episode. Example: `/mlpep 136`\n- /mlpcomic `<comic name>`: Shows specific information about a My Little Pony comic. Example: `/mlpcomic Nightmare Rarity`\n- /rpony | /randompony: Sends a random artwork made by the My Little Pony community.",
|
||||
"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}`",
|
||||
"comicRes": "*MLP Comic Information for* \"`{input}`\"*:*\n\n*Name:* `{name}`\n*Fandom URL:* [{url}]({url})\n*Series:* `{series}`\n*Writer:* `{writer}`\n*Artist:* `{artist}`\n*Colorist:* `{colorist}`\n*Letterer:* `{letterer}`\n*Editor:* `{editor}`",
|
||||
"charRes": "*{name} (ID: {id})*\n\n*Alias:* `{alias}`\n*Sex:* `{sex}`\n*Residence:* `{residence}`\n*Occupation:* `{occupation}`\n*Kind:* `{kind}`\n\n*Fandom URL:* [{url}]({url})",
|
||||
"epRes": "*{name} (ID: {id})*\n\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}`\n\n*Fandom URL:* [{url}]({url})",
|
||||
"comicRes": "*{name} (ID: {id})*\n\n*Series:* `{series}`\n*Writer:* `{writer}`\n*Artist:* `{artist}`\n*Colorist:* `{colorist}`\n*Letterer:* `{letterer}`\n*Editor:* `{editor}`\n\n*Fandom URL:* [{url}]({url})",
|
||||
"noCharName": "Please provide the character's name.",
|
||||
"noCharFound": "No character found.",
|
||||
"noEpisodeNum": "Please provide the episode's number.",
|
||||
|
@ -95,9 +95,9 @@
|
||||
"ponyApi": {
|
||||
"helpEntry": "My Little Pony",
|
||||
"helpDesc": "*My Little Pony*\n\n- /mlp: Exibe esta mensagem de ajuda.\n- /mlpchar `<nome do personagem>`: Mostra informações específicas sobre um personagem de My Little Pony em inglês. Exemplo: `/mlpchar twilight`\n- /mlpep: Mostra informações específicas sobre um episódio de My Little Pony em inglês. Exemplo: `/mlpep 136`\n- /mlpcomic `<nome da comic>`: Mostra informações específicas sobre uma comic de My Little Pony em inglês. Exemplo: `/mlpcomic Nightmare Rarity`\n- /rpony | /randompony: Envia uma arte aleatória feita pela comunidade de My Little Pony.",
|
||||
"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}`",
|
||||
"comicRes": "*Informações da Comic de MLP para* \"`{input}`\"*:*\n\n*Nome:* `{name}`\n*URL do Fandom:* [{url}]({url})\n*Série:* `{series}`\n*Escritor:* `{writer}`\n*Artista:* `{artist}`\n*Colorista:* `{colorist}`\n*Letrista:* `{letterer}`\n*Editor:* `{editor}`",
|
||||
"charRes": "*{name} (ID: {id})*\n\n*Apelido:* `{alias}`\n*Sexo:* `{sex}`\n*Residência:* `{residence}`\n*Ocupação:* `{occupation}`\n*Tipo:* `{kind}`\n\n*URL do Fandom:* [{url}]({url})",
|
||||
"epRes": "*{name} (ID: {id})*\n\n*Temporada:* `{season}`\n*Episódio:* `{episode}`\n*Número do Episódio:* `{overall}`\n*Data de lançamento:* `{airdate}`\n*História por:* `{storyby}`\n*Escrito por:* `{writtenby}`\n*Storyboard:* `{storyboard}`\n\n*URL no Fandom:* [{url}]({url})",
|
||||
"comicRes": "*{name} (ID: {id})*\n\n*Série:* `{series}`\n*Roteirista:* `{writer}`\n*Artista:* `{artist}`\n*Colorista:* `{colorist}`\n*Letrista:* `{letterer}`\n*Editor:* `{editor}`\n\n*URL no Fandom:* [{url}]({url})",
|
||||
"noCharName": "Por favor, forneça o nome do personagem.",
|
||||
"noCharFound": "Nenhum personagem encontrado.",
|
||||
"noEpisodeNum": "Por favor, forneça o número do episódio.",
|
||||
|
Loading…
x
Reference in New Issue
Block a user