From 2d54504de8350aef3f595aa728779c539b85cc40 Mon Sep 17 00:00:00 2001 From: RogueException Date: Thu, 15 Oct 2015 03:27:29 -0300 Subject: [PATCH] Added support for single-line code blocks --- src/Discord.Net/Format.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net/Format.cs b/src/Discord.Net/Format.cs index 9913ff352..729144554 100644 --- a/src/Discord.Net/Format.cs +++ b/src/Discord.Net/Format.cs @@ -103,7 +103,12 @@ namespace Discord /// Returns a markdown-formatted string with strikeout formatting, optionally escaping the contents. public static string Code(string text, string language = null, bool escape = true) - => $"```{language ?? ""}\n{(escape ? Escape(text) : text)}\n```"; + { + if (text.Contains("\n")) + return $"```{language ?? ""}\n{(escape ? Escape(text) : text)}\n```"; + else + return $"`{(escape ? Escape(text) : text)}`"; + } /// Returns a markdown-formatted string with multiple formatting, optionally escaping the contents. public static string Multiple(string text, bool escape = true,