feature: Add support for spoiler formatting & attachments (#1255)
Resolves #1216. * Add support for spoiler formatting * Implement support for sending message attachments that are spoilers * use consistent naming * update docstring for new isSpoiler param * move extension method to be under core project, make spoiler prefix a const * typo fix * update missing xmldocs * move SpoilerPrefix const outside of interface * Add isSpoiler support to webhook client adds the isSpoiler field to uploading files with a webhook, which will only insert "SPOILER_" to the start of the filename. This does not include other fields in the payload, as this is not in the documentation, and was not observed like in the regular client
This commit is contained in:
committed by
Christopher F
parent
76f82d687b
commit
f3b20b2b6d
@@ -4,7 +4,7 @@ namespace Discord
|
||||
public static class Format
|
||||
{
|
||||
// Characters which need escaping
|
||||
private static readonly string[] SensitiveCharacters = { "\\", "*", "_", "~", "`" };
|
||||
private static readonly string[] SensitiveCharacters = { "\\", "*", "_", "~", "`", "|" };
|
||||
|
||||
/// <summary> Returns a markdown-formatted string with bold formatting. </summary>
|
||||
public static string Bold(string text) => $"**{text}**";
|
||||
@@ -14,6 +14,8 @@ namespace Discord
|
||||
public static string Underline(string text) => $"__{text}__";
|
||||
/// <summary> Returns a markdown-formatted string with strikethrough formatting. </summary>
|
||||
public static string Strikethrough(string text) => $"~~{text}~~";
|
||||
/// <summary> Returns a string with spoiler formatting. </summary>
|
||||
public static string Spoiler(string text) => $"||{text}||";
|
||||
/// <summary> Returns a markdown-formatted URL. Only works in <see cref="EmbedBuilder"/> descriptions and fields. </summary>
|
||||
public static string Url(string text, string url) => $"[{text}]({url})";
|
||||
/// <summary> Escapes a URL so that a preview is not generated. </summary>
|
||||
|
||||
Reference in New Issue
Block a user