Replace deprecated url.parse

This commit is contained in:
Dragon Fire
2021-03-08 16:49:41 -05:00
parent 8f1a53ba83
commit 1d6a3a44f7
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
const crypto = require('crypto');
const { decode: decodeHTML } = require('html-entities');
const { stripIndents } = require('common-tags');
const url = require('url');
const { URL } = require('url');
const { SUCCESS_EMOJI_ID } = process.env;
const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea', 'ya', 'hai', 'si', 'sí', 'oui', 'はい', 'correct'];
const no = ['no', 'n', 'nah', 'nope', 'nop', 'iie', 'いいえ', 'non', 'fuck off'];
@@ -209,7 +209,7 @@ module.exports = class Util {
const uris = str.match(/(https?:\/\/\S+)/g);
if (!uris) return str;
for (const uri of uris) {
const parsed = url.parse(uri);
const parsed = new URL(uri);
if (!siteList.includes(parsed.host)) continue;
str = str.replace(uri, text);
}