From acd431b0351a9b1d489705888e83192ca0cb81bc Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Wed, 13 Oct 2021 22:44:23 -0500 Subject: [PATCH] Decode html entities in question --- index.js | 3 ++- package-lock.json | 11 +++++++++++ package.json | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2865af4..c6c6c9c 100755 --- a/index.js +++ b/index.js @@ -15,6 +15,7 @@ const generatedRound = require("./mongooseModels/mongooseGeneratedRoundModel.js" const mongoose = require("mongoose"); const gitlog = require("gitlog").default; const config = require("./config.json"); +const decode = require('html-entities').decode; const helpMessage = "AwesomeSciBo has migrated to using slash commands! You can take a look at the different commands by typing `/` and clicking on the AwesomeSciBo icon." @@ -263,7 +264,7 @@ async function training(subject, interaction) { const tossupQuestion = data.tossup_question; const tossupAnswer = data.tossup_answer; const messageFilter = (m) => m.author.id === authorId; - interaction.reply({ content: tossupQuestion + `\n\n||Source: ${data.uri}||` }) + interaction.reply({ content: decode(tossupQuestion) + `\n\n||Source: ${data.uri}||` }) .then(() => { interaction.channel.awaitMessages({ messageFilter, diff --git a/package-lock.json b/package-lock.json index 6963a43..2a5ebb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "eslint": "^7.21.0", "fs": "^0.0.1-security", "gitlog": "^4.0.4", + "html-entities": "^2.3.2", "mongoose": "^5.12.5", "node-fetch": "^2.6.1" }, @@ -927,6 +928,11 @@ "node": ">=8" } }, + "node_modules/html-entities": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.2.tgz", + "integrity": "sha512-c3Ab/url5ksaT0WyleslpBEthOzWhrjQbg75y7XUsfSzi3Dgzt0l8w5e7DylRn15MTlMMD58dTfzddNS2kcAjQ==" + }, "node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -2480,6 +2486,11 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, + "html-entities": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.2.tgz", + "integrity": "sha512-c3Ab/url5ksaT0WyleslpBEthOzWhrjQbg75y7XUsfSzi3Dgzt0l8w5e7DylRn15MTlMMD58dTfzddNS2kcAjQ==" + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", diff --git a/package.json b/package.json index 4b7e884..da4b3a1 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "eslint": "^7.21.0", "fs": "^0.0.1-security", "gitlog": "^4.0.4", + "html-entities": "^2.3.2", "mongoose": "^5.12.5", "node-fetch": "^2.6.1" },