diff --git a/src/matrixeventprocessor.ts b/src/matrixeventprocessor.ts index 9236e9d0ee4cb837bad3111ef9c786dcf8a795f0..749af4b90240bdd470f1388c031ceb9455377dba 100644 --- a/src/matrixeventprocessor.ts +++ b/src/matrixeventprocessor.ts @@ -48,6 +48,16 @@ export class MatrixEventProcessor { body = body.replace(new RegExp(`@here`, "g"), "@ here"); } + /* See issue #82 + const isMarkdown = (event.content.format === "org.matrix.custom.html"); + if (!isMarkdown) { + body = "\\" + body; + }*/ + + if (event.content.msgtype === "m.emote") { + body = `*${body}*`; + } + // Handle discord custom emoji body = this.ReplaceDiscordEmoji(body, channel.guild); @@ -64,15 +74,6 @@ export class MatrixEventProcessor { const mxClient = this.bridge.getClientFactory().getClientAs(); avatarUrl = mxClient.mxcUrlToHttp(profile.avatar_url); } - /* See issue #82 - const isMarkdown = (event.content.format === "org.matrix.custom.html"); - if (!isMarkdown) { - body = "\\" + body; - } - if (event.content.msgtype === "m.emote") { - body = `*${body}*`; - } - */ } return new Discord.RichEmbed({ author: { diff --git a/test/test_matrixeventprocessor.ts b/test/test_matrixeventprocessor.ts index 01572ecc1c22b1bd15418551dd3b51f52c8dac04..f5f61d82137d31eaa14fb882770633ab70098e3f 100644 --- a/test/test_matrixeventprocessor.ts +++ b/test/test_matrixeventprocessor.ts @@ -242,6 +242,17 @@ describe("MatrixEventProcessor", () => { }, {avatar_url: "test"}, mockChannelEmojis as any); Chai.assert.equal(evt.description, "I like :lamecake:"); }); + it("Should show emotes with italics.", () => { + const processor = createMatrixEventProcessor(false, false, true); + const evt = processor.EventToEmbed({ + sender: "@test:localhost", + content: { + body: "eats pizza", + msgtype: "m.emote", + }, + }, null, mockChannel as any); + Chai.assert.equal(evt.description, "*eats pizza*"); + }); }); describe("FindMentionsInPlainBody", () => { it("processes mentioned username correctly", async () => {