Add Node packages for fetch/DOM
This commit is contained in:
@@ -13,6 +13,8 @@ import {
|
||||
TextChannel,
|
||||
User
|
||||
} from 'discord.js';
|
||||
import fetch from 'node-fetch';
|
||||
import { JSDOM } from 'jsdom';
|
||||
import { logError, logInfo } from '../logging';
|
||||
import {
|
||||
db,
|
||||
@@ -68,8 +70,8 @@ async function fetchMotd()
|
||||
{
|
||||
const res = await fetch(process.env.MOTD_HREF);
|
||||
const xml = await res.text();
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(xml, 'text/html');
|
||||
const parser = new JSDOM(xml);
|
||||
const doc = parser.window.document;
|
||||
return doc.querySelector(process.env.MOTD_QUERY).textContent;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user