From f005af37b401e921d5402a9d4db8519bdcdd5192 Mon Sep 17 00:00:00 2001 From: Christopher Felegy Date: Tue, 27 Nov 2018 17:31:47 -0500 Subject: [PATCH] feature: add Format.Url, Format.EscapeUrl Format.Url formats a URL into a markdown `[]()` masked URL. Format.EscapeUrl formats a URL into a Discord `<>` escaped URL. --- src/Discord.Net.Core/Format.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Discord.Net.Core/Format.cs b/src/Discord.Net.Core/Format.cs index 0b16daeb1..fec9b607a 100644 --- a/src/Discord.Net.Core/Format.cs +++ b/src/Discord.Net.Core/Format.cs @@ -14,6 +14,10 @@ namespace Discord public static string Underline(string text) => $"__{text}__"; /// Returns a markdown-formatted string with strikethrough formatting. public static string Strikethrough(string text) => $"~~{text}~~"; + /// Returns a markdown-formatted URL. Only works in descriptions and fields. + public static string Url(string text, string url) => $"[{text}]({url})"; + /// Escapes a URL so that a preview is not generated. + public static string EscapeUrl(string url) => $"<{url}>"; /// Returns a markdown-formatted string with codeblock formatting. public static string Code(string text, string language = null)