From 2d14e843127c1479e4c1246b74d65222b7508202 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 18 Aug 2023 01:22:33 +1200 Subject: [PATCH] update discord-markdown to escape less stuff --- d2m/converters/message-to-event.test.js | 10 ++++++++ package-lock.json | 4 ++-- package.json | 2 +- test/data.js | 31 +++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/d2m/converters/message-to-event.test.js b/d2m/converters/message-to-event.test.js index df941966..86942a76 100644 --- a/d2m/converters/message-to-event.test.js +++ b/d2m/converters/message-to-event.test.js @@ -39,6 +39,16 @@ test("message2event: simple plaintext", async t => { }]) }) +test("message2event: simple plaintext with quotes", async t => { + const events = await messageToEvent(data.message.simple_plaintext_with_quotes, data.guild.general, {}) + t.deepEqual(events, [{ + $type: "m.room.message", + "m.mentions": {}, + msgtype: "m.text", + body: `then he said, "you and her aren't allowed in here!"` + }]) +}) + test("message2event: simple user mention", async t => { const events = await messageToEvent(data.message.simple_user_mention, data.guild.general, {}) t.deepEqual(events, [{ diff --git a/package-lock.json b/package-lock.json index c6b6004a..875e3297 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "better-sqlite3": "^8.3.0", "cloudstorm": "^0.8.0", - "discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#9799e4f79912d07f89a030e479e82fcc1e75bc81", + "discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#440130ef343c8183a81c7c09809731484aa3a182", "heatsync": "^2.4.1", "js-yaml": "^4.1.0", "matrix-appservice": "^2.0.0", @@ -1051,7 +1051,7 @@ }, "node_modules/discord-markdown": { "version": "2.4.1", - "resolved": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#9799e4f79912d07f89a030e479e82fcc1e75bc81", + "resolved": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#440130ef343c8183a81c7c09809731484aa3a182", "license": "MIT", "dependencies": { "simple-markdown": "^0.7.2" diff --git a/package.json b/package.json index 65575003..bc0a0dbd 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "dependencies": { "better-sqlite3": "^8.3.0", "cloudstorm": "^0.8.0", - "discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#9799e4f79912d07f89a030e479e82fcc1e75bc81", + "discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#440130ef343c8183a81c7c09809731484aa3a182", "heatsync": "^2.4.1", "js-yaml": "^4.1.0", "matrix-appservice": "^2.0.0", diff --git a/test/data.js b/test/data.js index 7e3fdae2..a1d3ece2 100644 --- a/test/data.js +++ b/test/data.js @@ -170,6 +170,37 @@ module.exports = { flags: 0, components: [] }, + simple_plaintext_with_quotes: { + id: "1126733830494093454", + type: 0, + content: `then he said, "you and her aren't allowed in here!"`, + channel_id: "112760669178241024", + author: { + id: "111604486476181504", + username: "kyuugryphon", + avatar: "e4ce31267ca524d19be80e684d4cafa1", + discriminator: "0", + public_flags: 0, + flags: 0, + banner: null, + accent_color: null, + global_name: "KyuuGryphon", + avatar_decoration: null, + display_name: "KyuuGryphon", + banner_color: null + }, + attachments: [], + embeds: [], + mentions: [], + mention_roles: [], + pinned: false, + mention_everyone: false, + tts: false, + timestamp: "2023-07-07T04:37:58.892000+00:00", + edited_timestamp: null, + flags: 0, + components: [] + }, simple_user_mention: { id: "1126739682080858234", type: 0,