generated from nhcarrigan/template
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
* @author Naomi Carrigan
|
* @author Naomi Carrigan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable complexity -- These need a lot of logic. */
|
||||||
|
|
||||||
import { ChannelType } from "discord.js";
|
import { ChannelType } from "discord.js";
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Importing a class.
|
// eslint-disable-next-line @typescript-eslint/naming-convention -- Importing a class.
|
||||||
import Parser from "rss-parser";
|
import Parser from "rss-parser";
|
||||||
@@ -44,6 +46,9 @@ const postFreeCodeCampNews = async(amari: Amari): Promise<void> => {
|
|||||||
if (!channel.isSendable()) {
|
if (!channel.isSendable()) {
|
||||||
throw new Error("News channel is not sendable.");
|
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) => {
|
await Promise.all(latestPosts.map(async(post) => {
|
||||||
const sent = await channel.send(post.link);
|
const sent = await channel.send(post.link);
|
||||||
if (channel.type === ChannelType.GuildAnnouncement) {
|
if (channel.type === ChannelType.GuildAnnouncement) {
|
||||||
@@ -86,6 +91,9 @@ const postHackerNews = async(amari: Amari): Promise<void> => {
|
|||||||
if (!channel.isSendable()) {
|
if (!channel.isSendable()) {
|
||||||
throw new Error("News channel is not sendable.");
|
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) => {
|
await Promise.all(latestPosts.map(async(post) => {
|
||||||
const sent = await channel.send(post.link);
|
const sent = await channel.send(post.link);
|
||||||
if (channel.type === ChannelType.GuildAnnouncement) {
|
if (channel.type === ChannelType.GuildAnnouncement) {
|
||||||
|
|||||||
Reference in New Issue
Block a user