All checks were successful
Build and Push Container / build (push) Successful in 49s
29 lines
834 B
TypeScript
29 lines
834 B
TypeScript
/* eslint-disable camelcase */
|
|
import axios from 'axios';
|
|
import { Chapter, Manga } from '../types';
|
|
import { getMangaTitle } from './get-manga-title';
|
|
|
|
export const sendWebhook = async (args: {
|
|
webhookUrl: string;
|
|
manga: Manga;
|
|
latestChapter: Chapter;
|
|
}) => {
|
|
const { webhookUrl, manga, latestChapter } = args;
|
|
const title = getMangaTitle(manga);
|
|
|
|
await axios.post(webhookUrl, {
|
|
username: 'Manga Updates',
|
|
avatar_url: 'https://mangadex.org/pwa/icons/icon-180.png',
|
|
embeds: [
|
|
{
|
|
url: `https://mangadex.org/chapter/${latestChapter.id}`,
|
|
image: {
|
|
url: `https://og.mangadex.org/og-image/chapter/${latestChapter.id}`,
|
|
},
|
|
title: `${title}`,
|
|
description: ` Ch. ${latestChapter.attributes.chapter} - ${latestChapter.attributes.title} `,
|
|
},
|
|
],
|
|
});
|
|
};
|