/mlpcomic (wip, should not be uncommented by now)
This commit is contained in:
parent
fe609e8e03
commit
6947a79f25
3 changed files with 74 additions and 1 deletions
|
@ -161,4 +161,72 @@ module.exports = (bot) => {
|
|||
});
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
// bot.command("mlpcomic", spamwatchMiddleware, async (ctx) => {
|
||||
// const Strings = getStrings(ctx.from.language_code);
|
||||
// const userInput = ctx.message.text.split(' ').slice(1).join(' ');
|
||||
|
||||
// if (!userInput) {
|
||||
// ctx.reply(Strings.ponyApiNoComicName, {
|
||||
// parse_mode: 'Markdown',
|
||||
// reply_to_message_id: ctx.message.message_id
|
||||
// });
|
||||
// return;
|
||||
// };
|
||||
|
||||
// const apiUrl = `http://ponyapi.net/v1/comics-story/${userInput}`;
|
||||
|
||||
// try {
|
||||
// const response = await axios(apiUrl);
|
||||
// const comicArray = [];
|
||||
// console.log(response.data.data)
|
||||
// if (Array.isArray(response.data.data)) {
|
||||
// response.data.data.forEach(comic => {
|
||||
// comicArray.push({
|
||||
// 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',
|
||||
// editor: comic.editor
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
|
||||
// if (comicArray.length > 0) {
|
||||
// const result = Strings.ponyApiComicRes
|
||||
// .replace("{input}", userInput)
|
||||
// .replace("{name}", comicArray[0].name)
|
||||
// .replace("{series}", comicArray[0].series)
|
||||
// .replace("{url}", comicArray[0].url)
|
||||
// .replace("{writer}", comicArray[0].writer)
|
||||
// .replace("{artist}", comicArray[0].artist)
|
||||
// .replace("{colorist}", comicArray[0].colorist)
|
||||
// .replace("{letterer}", comicArray[0].writtenby)
|
||||
// .replace("{editor}", comicArray[0].editor);
|
||||
|
||||
// ctx.replyWithPhoto(comicArray[0].image, {
|
||||
// caption: `${result}`,
|
||||
// parse_mode: 'Markdown',
|
||||
// disable_web_page_preview: true,
|
||||
// reply_to_message_id: ctx.message.message_id
|
||||
// });
|
||||
// } else {
|
||||
// ctx.reply(Strings.ponyApiNoComicFound, {
|
||||
// parse_mode: 'Markdown',
|
||||
// reply_to_message_id: ctx.message.message_id
|
||||
// });
|
||||
// };
|
||||
// } catch (error) {
|
||||
// console.error(error);
|
||||
// ctx.reply(Strings.ponyApiErr, {
|
||||
// parse_mode: 'Markdown',
|
||||
// reply_to_message_id: ctx.message.message_id
|
||||
// });
|
||||
// };
|
||||
// });
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue