This commit is contained in:
Dragon Fire
2020-10-12 17:05:27 -04:00
parent 1b79f97c97
commit e710445220
3 changed files with 7 additions and 5 deletions
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { unescape } = require('html-escaper');
const Entities = require('html-entities').AllHtmlEntities;
const entities = new Entities();
const { stripIndents } = require('common-tags');
const { verify } = require('../../util/Util');
@@ -29,7 +30,7 @@ module.exports = class WillYouPressTheButtonCommand extends Command {
try {
const dilemma = await this.fetchDilemma();
await msg.reply(stripIndents`
**${unescape(dilemma.txt1)}** but **${unescape(dilemma.txt2)}**
**${entities.decode(dilemma.txt1)}** but **${entities.decode(dilemma.txt2)}**
Will you press the button?
_Respond with [y]es or [n]o to continue._
+1 -1
View File
@@ -47,7 +47,7 @@
"eslint": "^7.11.0",
"gifencoder": "^2.0.1",
"gm": "^1.23.1",
"html-escaper": "^3.0.0",
"html-entities": "^1.3.1",
"js-beautify": "^1.13.0",
"mathjs": "^7.5.1",
"moment": "^2.29.1",
+3 -2
View File
@@ -1,5 +1,6 @@
const crypto = require('crypto');
const { unescape } = require('html-escaper');
const Entities = require('html-entities').AllHtmlEntities;
const entities = new Entities();
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'];
@@ -206,7 +207,7 @@ module.exports = class Util {
static cleanAnilistHTML(html, removeLineBreaks = true) {
let clean = html;
if (removeLineBreaks) clean = clean.replace(/\r|\n|\f/g, '');
clean = unescape(clean);
clean = entities.decode(clean);
clean = clean
.replace(/<br/g, '\n')
.replace(/<\/?i>/g, '*')