Skip to content

Commit

Permalink
Decode HTML entities from Twitter
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIPv4 committed Jan 9, 2022
1 parent 7bd8942 commit fe838f8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"homepage": "https://github.com/MattIPv4/tweets-to-discord#readme",
"dependencies": {
"html-entities": "^2.3.2",
"workers-sentry": "^0.0.6"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const WorkersSentry = require('workers-sentry/worker');
const htmlEntities = require('html-entities');

// Util to send a text response
const textResponse = content => new Response(content, {
Expand Down Expand Up @@ -41,7 +42,7 @@ const postDiscordTweet = (type, content, links, username, avatar) => fetch(proce
method: 'POST',
headers: { 'Content-type': 'application/json' },
body: JSON.stringify({
content: `**${type}**\n\n${quoteText(escapeMarkdown(content))}\n\n${suppressLinks(links)}`,
content: `**${type}**\n\n${quoteText(escapeMarkdown(htmlEntities.decode(content)))}\n\n${suppressLinks(links)}`,
username,
avatar_url: avatar,
}),
Expand Down

0 comments on commit fe838f8

Please sign in to comment.