/* 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} `, }, ], }); };