From 23adab0d9a980849d848cc0ff253f4dead2453eb Mon Sep 17 00:00:00 2001
From: Will Hunt <will@half-shot.uk>
Date: Fri, 9 Feb 2018 21:59:07 +0000
Subject: [PATCH] Don't format markdown if the body is plain

---
 src/bot.ts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/bot.ts b/src/bot.ts
index 854fde9..796eb66 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -152,7 +152,7 @@ export class DiscordBot {
   }
 
   public MatrixEventToEmbed(event: any, profile: any, channel: Discord.TextChannel): Discord.RichEmbed {
-    const body = this.config.bridge.disableDiscordMentions ? event.content.body :
+    let body = this.config.bridge.disableDiscordMentions ? event.content.body :
                  this.msgProcessor.FindMentionsInPlainBody(
                      event.content.body,
                      channel.members.array(),
@@ -163,6 +163,10 @@ export class DiscordBot {
         const mxClient = this.bridge.getClientFactory().getClientAs();
         profile.avatar_url = mxClient.mxcUrlToHttp(profile.avatar_url);
       }
+      const isMarkdown = (event.content.format === "org.matrix.custom.html");
+      if(!isMarkdown) {
+        body = "\\" + body;
+      }
       return new Discord.RichEmbed({
         author: {
           name: profile.displayname,
-- 
GitLab