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)) {
|
if (verifyInput(ctx, userInput, noCharName)) {
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
|
|
||||||
const capitalizedInput = capitalizeFirstLetter(userInput);
|
const capitalizedInput = capitalizeFirstLetter(userInput);
|
||||||
const apiUrl = `${Resources.ponyApi}/character/${capitalizedInput}`;
|
const apiUrl = `${Resources.ponyApi}/character/${capitalizedInput}`;
|
||||||
@ -48,13 +48,14 @@ module.exports = (bot) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
charactersArray.push({
|
charactersArray.push({
|
||||||
|
id: character.id,
|
||||||
name: character.name,
|
name: character.name,
|
||||||
alias: aliases.length > 0 ? aliases.join(', ') : 'N/A',
|
alias: aliases.length > 0 ? aliases.join(', ') : 'None',
|
||||||
url: character.url,
|
url: character.url,
|
||||||
sex: character.sex,
|
sex: character.sex,
|
||||||
residence: character.residence ? character.residence.replace(/\n/g, ' / ') : 'N/A',
|
residence: character.residence ? character.residence.replace(/\n/g, ' / ') : 'None',
|
||||||
occupation: character.occupation ? character.occupation.replace(/\n/g, ' / ') : 'N/A',
|
occupation: character.occupation ? character.occupation.replace(/\n/g, ' / ') : 'None',
|
||||||
kind: character.kind ? character.kind.join(', ') : 'N/A',
|
kind: character.kind ? character.kind.join(', ') : 'None',
|
||||||
image: character.image
|
image: character.image
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -62,7 +63,7 @@ module.exports = (bot) => {
|
|||||||
|
|
||||||
if (charactersArray.length > 0) {
|
if (charactersArray.length > 0) {
|
||||||
const result = Strings.ponyApi.charRes
|
const result = Strings.ponyApi.charRes
|
||||||
.replace("{input}", userInput)
|
.replace("{id}", charactersArray[0].id)
|
||||||
.replace("{name}", charactersArray[0].name)
|
.replace("{name}", charactersArray[0].name)
|
||||||
.replace("{alias}", charactersArray[0].alias)
|
.replace("{alias}", charactersArray[0].alias)
|
||||||
.replace("{url}", charactersArray[0].url)
|
.replace("{url}", charactersArray[0].url)
|
||||||
@ -100,7 +101,7 @@ module.exports = (bot) => {
|
|||||||
|
|
||||||
if (verifyInput(ctx, userInput, noEpisodeNum, true)) {
|
if (verifyInput(ctx, userInput, noEpisodeNum, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
|
|
||||||
const apiUrl = `${Resources.ponyApi}/episode/by-overall/${userInput}`;
|
const apiUrl = `${Resources.ponyApi}/episode/by-overall/${userInput}`;
|
||||||
|
|
||||||
@ -111,6 +112,7 @@ module.exports = (bot) => {
|
|||||||
if (Array.isArray(response.data.data)) {
|
if (Array.isArray(response.data.data)) {
|
||||||
response.data.data.forEach(episode => {
|
response.data.data.forEach(episode => {
|
||||||
episodeArray.push({
|
episodeArray.push({
|
||||||
|
id: episode.id,
|
||||||
name: episode.name,
|
name: episode.name,
|
||||||
image: episode.image,
|
image: episode.image,
|
||||||
url: episode.url,
|
url: episode.url,
|
||||||
@ -118,16 +120,16 @@ module.exports = (bot) => {
|
|||||||
episode: episode.episode,
|
episode: episode.episode,
|
||||||
overall: episode.overall,
|
overall: episode.overall,
|
||||||
airdate: episode.airdate,
|
airdate: episode.airdate,
|
||||||
storyby: episode.storyby ? episode.storyby.replace(/\n/g, ' / ') : 'N/A',
|
storyby: episode.storyby ? episode.storyby.replace(/\n/g, ' / ') : 'None',
|
||||||
writtenby: episode.writtenby ? episode.writtenby.replace(/\n/g, ' / ') : 'N/A',
|
writtenby: episode.writtenby ? episode.writtenby.replace(/\n/g, ' / ') : 'None',
|
||||||
storyboard: episode.storyboard ? episode.storyboard.replace(/\n/g, ' / ') : 'N/A',
|
storyboard: episode.storyboard ? episode.storyboard.replace(/\n/g, ' / ') : 'None',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (episodeArray.length > 0) {
|
if (episodeArray.length > 0) {
|
||||||
const result = Strings.ponyApi.epRes
|
const result = Strings.ponyApi.epRes
|
||||||
.replace("{input}", userInput)
|
.replace("{id}", episodeArray[0].id)
|
||||||
.replace("{name}", episodeArray[0].name)
|
.replace("{name}", episodeArray[0].name)
|
||||||
.replace("{url}", episodeArray[0].url)
|
.replace("{url}", episodeArray[0].url)
|
||||||
.replace("{season}", episodeArray[0].season)
|
.replace("{season}", episodeArray[0].season)
|
||||||
@ -178,14 +180,15 @@ module.exports = (bot) => {
|
|||||||
if (Array.isArray(response.data.data)) {
|
if (Array.isArray(response.data.data)) {
|
||||||
response.data.data.forEach(comic => {
|
response.data.data.forEach(comic => {
|
||||||
comicArray.push({
|
comicArray.push({
|
||||||
|
id: comic.id,
|
||||||
name: comic.name,
|
name: comic.name,
|
||||||
series: comic.series,
|
series: comic.series,
|
||||||
image: comic.image,
|
image: comic.image,
|
||||||
url: comic.url,
|
url: comic.url,
|
||||||
writer: comic.writer ? comic.writer.replace(/\n/g, ' / ') : 'N/A',
|
writer: comic.writer ? comic.writer.replace(/\n/g, ' / ') : 'None',
|
||||||
artist: comic.artist ? comic.artist.replace(/\n/g, ' / ') : 'N/A',
|
artist: comic.artist ? comic.artist.replace(/\n/g, ' / ') : 'None',
|
||||||
colorist: comic.colorist ? comic.colorist.replace(/\n/g, ' / ') : 'N/A',
|
colorist: comic.colorist ? comic.colorist.replace(/\n/g, ' / ') : 'None',
|
||||||
letterer: comic.letterer ? comic.letterer.replace(/\n/g, ' / ') : 'N/A',
|
letterer: comic.letterer ? comic.letterer.replace(/\n/g, ' / ') : 'None',
|
||||||
editor: comic.editor
|
editor: comic.editor
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -193,7 +196,7 @@ module.exports = (bot) => {
|
|||||||
|
|
||||||
if (comicArray.length > 0) {
|
if (comicArray.length > 0) {
|
||||||
const result = Strings.ponyApi.comicRes
|
const result = Strings.ponyApi.comicRes
|
||||||
.replace("{input}", userInput)
|
.replace("{id}", comicArray[0].id)
|
||||||
.replace("{name}", comicArray[0].name)
|
.replace("{name}", comicArray[0].name)
|
||||||
.replace("{series}", comicArray[0].series)
|
.replace("{series}", comicArray[0].series)
|
||||||
.replace("{url}", comicArray[0].url)
|
.replace("{url}", comicArray[0].url)
|
||||||
|
@ -5,7 +5,7 @@ const spamwatchMiddleware = require('../spamwatch/Middleware.js')(isOnSpamWatch)
|
|||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
|
|
||||||
module.exports = (bot) => {
|
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);
|
const Strings = getStrings(ctx.from.language_code);
|
||||||
try {
|
try {
|
||||||
const response = await axios(Resources.randomPonyApi);
|
const response = await axios(Resources.randomPonyApi);
|
||||||
@ -20,7 +20,7 @@ module.exports = (bot) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.replyWithPhoto(response.data.pony.representations.full, {
|
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',
|
parse_mode: 'Markdown',
|
||||||
reply_to_message_id: ctx.message.message_id
|
reply_to_message_id: ctx.message.message_id
|
||||||
});
|
});
|
||||||
|
@ -95,9 +95,9 @@
|
|||||||
"ponyApi": {
|
"ponyApi": {
|
||||||
"helpEntry": "My Little Pony",
|
"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.",
|
"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}`",
|
"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": "*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}`",
|
"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": "*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}`",
|
"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.",
|
"noCharName": "Please provide the character's name.",
|
||||||
"noCharFound": "No character found.",
|
"noCharFound": "No character found.",
|
||||||
"noEpisodeNum": "Please provide the episode's number.",
|
"noEpisodeNum": "Please provide the episode's number.",
|
||||||
|
@ -95,9 +95,9 @@
|
|||||||
"ponyApi": {
|
"ponyApi": {
|
||||||
"helpEntry": "My Little Pony",
|
"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.",
|
"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}`",
|
"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": "*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}`",
|
"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": "*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}`",
|
"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.",
|
"noCharName": "Por favor, forneça o nome do personagem.",
|
||||||
"noCharFound": "Nenhum personagem encontrado.",
|
"noCharFound": "Nenhum personagem encontrado.",
|
||||||
"noEpisodeNum": "Por favor, forneça o número do episódio.",
|
"noEpisodeNum": "Por favor, forneça o número do episódio.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user