diff --git a/src/modules/postNews.ts b/src/modules/postNews.ts index ef5b2b4..421ca23 100644 --- a/src/modules/postNews.ts +++ b/src/modules/postNews.ts @@ -4,6 +4,8 @@ * @author Naomi Carrigan */ +/* eslint-disable complexity -- These need a lot of logic. */ + import { ChannelType } from "discord.js"; // eslint-disable-next-line @typescript-eslint/naming-convention -- Importing a class. import Parser from "rss-parser"; @@ -44,6 +46,9 @@ const postFreeCodeCampNews = async(amari: Amari): Promise => { if (!channel.isSendable()) { throw new Error("News channel is not sendable."); } + if (amari.lastRssItems.freeCodeCamp !== items[0]?.guid) { + amari.lastRssItems.freeCodeCamp = items[0]?.guid ?? null; + } await Promise.all(latestPosts.map(async(post) => { const sent = await channel.send(post.link); if (channel.type === ChannelType.GuildAnnouncement) { @@ -86,6 +91,9 @@ const postHackerNews = async(amari: Amari): Promise => { if (!channel.isSendable()) { throw new Error("News channel is not sendable."); } + if (amari.lastRssItems.hackerNews !== latestPosts[0]?.guid) { + amari.lastRssItems.hackerNews = latestPosts[0]?.guid ?? null; + } await Promise.all(latestPosts.map(async(post) => { const sent = await channel.send(post.link); if (channel.type === ChannelType.GuildAnnouncement) {