fix: actually cache the last news post ids
Node.js CI / Lint and Test (push) Successful in 40s

This commit is contained in:
2025-08-22 12:18:31 -07:00
parent 1d4f0af6f8
commit 06eba7ea2f
+8
View File
@@ -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<void> => {
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<void> => {
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) {