Class Format
A helper class for formatting characters.
Assembly: Discord.Net.Core.dll​
View Source​
public static class Format
Methods​
Bold(String)​
Returns a markdown-formatted string with bold formatting.
View Source​
public static string Bold(string text)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
Italics(String)​
Returns a markdown-formatted string with italics formatting.
View Source​
public static string Italics(string text)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
Underline(String)​
Returns a markdown-formatted string with underline formatting.
View Source​
public static string Underline(string text)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
Strikethrough(String)​
Returns a markdown-formatted string with strike-through formatting.
View Source​
public static string Strikethrough(string text)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
Spoiler(String)​
Returns a string with spoiler formatting.
View Source​
public static string Spoiler(string text)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
Url(String, String)​
Returns a markdown-formatted URL. Only works in Discord.EmbedBuilder descriptions and fields.
View Source​
public static string Url(string text, string url)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
System.String | url |
EscapeUrl(String)​
Escapes a URL so that a preview is not generated.
View Source​
public static string EscapeUrl(string url)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | url |
Code(String, String)​
Returns a markdown-formatted string with codeblock formatting.
View Source​
public static string Code(string text, string language = null)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
System.String | language |
Sanitize(String)​
Sanitizes the string, safely escaping any Markdown sequences.
View Source​
public static string Sanitize(string text)
Returns​
System.String
Parameters​
Type | Name |
---|---|
System.String | text |
Quote(String)​
Formats a string as a quote.
View Source​
public static string Quote(string text)
Returns​
System.String
: Gets the formatted quote text.
Parameters​
Type | Name | Description |
---|---|---|
System.String | text | The text to format. |
BlockQuote(String)​
Formats a string as a block quote.
View Source​
public static string BlockQuote(string text)
Returns​
System.String
: Gets the formatted block quote text.
Parameters​
Type | Name | Description |
---|---|---|
System.String | text | The text to format. |
StripMarkDown(String)​
Remove discord supported markdown from text.
View Source​
public static string StripMarkDown(string text)
Returns​
System.String
: Gets the unformatted text.
Parameters​
Type | Name | Description |
---|---|---|
System.String | text | The to remove markdown from. |
UsernameAndDiscriminator(IUser)​
Formats a user's username + discriminator while maintaining bidirectional unicode
View Source​
public static string UsernameAndDiscriminator(IUser user)
Returns​
System.String
: The username + discriminator
Parameters​
Type | Name | Description |
---|---|---|
Discord.IUser | user | The user whos username and discriminator to format |