diff --git a/classes/components/EmbedBase.js b/classes/components/EmbedBase.js
index cffd644c..6fa576eb 100644
--- a/classes/components/EmbedBase.js
+++ b/classes/components/EmbedBase.js
@@ -136,8 +136,7 @@ export class EmbedBase extends MessageEmbed {
this.description &&= truncate(this.description.trim(), { length: 4095, omission: '\u2026' });
// I'd like to split the embeds before slicing fields, if possible
this.fields = this.fields
- .map((f) => this.splitField(f))
- .flat()
+ .flatMap((f) => this.splitField(f))
.slice(0, 25)
.map((f) => ({
...f,
diff --git a/classes/services/AnnouncementService.js b/classes/services/AnnouncementService.js
index bf48013a..01085c6d 100644
--- a/classes/services/AnnouncementService.js
+++ b/classes/services/AnnouncementService.js
@@ -14,6 +14,7 @@
* along with this program. If not, see .
*/
+import { decode } from 'html-entities';
import { EmbedBase, Firebase, Logger } from '..';
import bot from '../../bot';
@@ -92,10 +93,15 @@ export class AnnouncementService {
fields: [
{
name: 'Message',
- value: announcement.content
- .replaceAll('
', '\n')
- .replaceAll('
', '\n') //this is kinda hacky ngl
- .replace(/<\/?[^>]+(>|$)/g, ''),
+ value: decode(
+ announcement.content
+ .replaceAll('
', '\n')
+ .replaceAll('
', '\n') //this is kinda hacky ngl
+ .replaceAll('
', '\n\t\u2022 ')
+ .replaceAll('', '\n')
+ .replaceAll('', '\n')
+ .replace(/<\/?[^>]+(>|$)/g, '')
+ ),
},
//TODO: cleanup dry code
...(!!announcement.resources.filter(({ kind }) => kind !== 'URL').length
diff --git a/classes/services/GradeService.js b/classes/services/GradeService.js
index 7b64f9d8..4bf6b587 100644
--- a/classes/services/GradeService.js
+++ b/classes/services/GradeService.js
@@ -14,6 +14,7 @@
* along with this program. If not, see .
*/
+import { decode } from 'html-entities';
import { round } from 'lodash-es';
import { EmbedBase, Firebase, Logger } from '..';
import bot from '../../bot';
@@ -106,10 +107,15 @@ export class GradeService {
{
name: `Feedback:`,
value: !!finalComment?.comment
- ? finalComment.comment
- .replaceAll('
', '\n')
- .replaceAll('', '\n') //this is kinda hacky ngl
- .replace(/<\/?[^>]+(>|$)/g, '')
+ ? decode(
+ finalComment.comment
+ .replaceAll('
', '\n')
+ .replaceAll('
', '\n') //this is kinda hacky ngl
+ .replaceAll('
', '\n\t\u2022 ')
+ .replaceAll('', '\n')
+ .replaceAll('', '\n')
+ .replace(/<\/?[^>]+(>|$)/g, '')
+ )
: 'None',
},
...(show_overall_grade
diff --git a/classes/services/InboxMessageService.js b/classes/services/InboxMessageService.js
index 81c72b34..ed68b840 100644
--- a/classes/services/InboxMessageService.js
+++ b/classes/services/InboxMessageService.js
@@ -14,7 +14,8 @@
* along with this program. If not, see .
*/
-import { EmbedBase, Firebase, Logger } from '..';
+import { decode } from 'html-entities';
+import { EmbedBase, Logger } from '..';
import bot from '../../bot';
export class InboxMessageService {
@@ -79,10 +80,15 @@ export class InboxMessageService {
content: `New message received from **${firstName} ${lastName}**:`,
embeds: [
new EmbedBase({
- description: inbox_message.content
- .replaceAll('
', '\n')
- .replaceAll('', '\n') //this is kinda hacky ngl
- .replace(/<\/?[^>]+(>|$)/g, ''),
+ description: decode(
+ inbox_message.content
+ .replaceAll('
', '\n')
+ .replaceAll('
', '\n') //this is kinda hacky ngl
+ .replaceAll('
', '\n\t\u2022 ')
+ .replaceAll('', '\n')
+ .replaceAll('', '\n')
+ .replace(/<\/?[^>]+(>|$)/g, '')
+ ),
fields: [
...(!!inbox_message.resources.filter(({ kind }) => kind !== 'URL').length
? [
diff --git a/package.json b/package.json
index f10d63a9..cd4ef3c8 100644
--- a/package.json
+++ b/package.json
@@ -32,6 +32,7 @@
"dotenv": "16.0.3",
"firebase-admin": "11.5.0",
"graphql-request": "5.1.0",
+ "html-entities": "2.3.3",
"klaw": "4.1.0",
"lodash-es": "4.17.21",
"moment": "2.29.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index fc7b432a..fbc5e811 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -8,6 +8,7 @@ specifiers:
express: 4.18.2
firebase-admin: 11.5.0
graphql-request: 5.1.0
+ html-entities: 2.3.3
klaw: 4.1.0
lodash-es: 4.17.21
moment: 2.29.4
@@ -23,6 +24,7 @@ dependencies:
dotenv: 16.0.3
firebase-admin: 11.5.0
graphql-request: 5.1.0_graphql@16.6.0
+ html-entities: 2.3.3
klaw: 4.1.0
lodash-es: 4.17.21
moment: 2.29.4
@@ -1236,6 +1238,10 @@ packages:
engines: {node: '>=8'}
dev: false
+ /html-entities/2.3.3:
+ resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==}
+ dev: false
+
/http-errors/2.0.0:
resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}
engines: {node: '>= 0.8'}