|
@@ -3,7 +3,7 @@ import interval from "interval-promise";
|
|
|
import { client, FORUMS_DOMAIN } from "../client";
|
|
|
import sha1 from "sha1";
|
|
|
import { TextChannel, Message, ReactionCollector, MessageReaction, Collector, User, Channel } from "discord.js";
|
|
|
-import { Dict } from "../util";
|
|
|
+import { Dict, isHtmlNode } from "../util";
|
|
|
import { getRepository, Not, IsNull } from "typeorm";
|
|
|
import { PostedForumNewsItem } from "@shared/db/entity/PostedForumsNewsItem";
|
|
|
import { KnownChannel } from "@shared/db/entity/KnownChannel";
|
|
@@ -34,7 +34,10 @@ export class ForumsNewsChecker {
|
|
|
});
|
|
|
this.turndown.addRule("link", {
|
|
|
filter: (node: HTMLElement) => node.nodeName === "A" && node.getAttribute("href") != null,
|
|
|
- replacement: (content: string, node: Node) => (node instanceof HTMLElement ? node.getAttribute("href") : null) ?? ""
|
|
|
+ replacement: (content: string, node: Node) => {
|
|
|
+ logger.info("Node type: %s, htmlelement type: %s", node.nodeType, Node.ELEMENT_NODE);
|
|
|
+ return (isHtmlNode(node) ? node.getAttribute("href") : null) ?? "";
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|