Class Markdown
java.lang.Object
com.github.alex1304.ultimategdbot.api.utils.Markdown
public class Markdown
extends java.lang.Object
-
Method Summary
Modifier and Type Method Description static java.lang.Stringbold(java.lang.String text)Formats the text with bold markdownstatic java.lang.Stringcode(java.lang.String text)Formats the text as code.static java.lang.StringcodeBlock(java.lang.String text)Formats the text as a code block.static java.lang.StringcodeBlock(java.lang.String text, java.lang.String language)Formats the text as a code block.static java.lang.Stringescape(java.lang.String text)Escapes characters used in Markdown syntax using a backslashstatic java.lang.Stringitalic(java.lang.String text)Formats the text with italic markdown.static java.lang.Stringitalic(java.lang.String text, boolean starVariant)Formats the text with italic markdownstatic java.lang.StringmaskedLink(java.lang.String clickableText, java.lang.String url)Make a masked link using markdown.static java.lang.Stringquote(java.lang.String text)Formats the text as a quote.static java.lang.Stringspoiler(java.lang.String text)Formats the text with spoiler markdown.static java.lang.Stringstrikethrough(java.lang.String text)Formats the text with strikethrough markdown.static java.lang.Stringunderline(java.lang.String text)Formats the text with underline markdown.
-
Method Details
-
escape
public static java.lang.String escape(java.lang.String text)Escapes characters used in Markdown syntax using a backslash- Parameters:
text- the Markdown text to escape- Returns:
- String
-
bold
public static java.lang.String bold(java.lang.String text)Formats the text with bold markdown- Parameters:
text- the text to format- Returns:
- the formatted text
-
italic
public static java.lang.String italic(java.lang.String text, boolean starVariant)Formats the text with italic markdown- Parameters:
text- the text to formatstarVariant- whether to use stars (*) or underscores (_) to make italic- Returns:
- the formatted text
-
italic
public static java.lang.String italic(java.lang.String text)Formats the text with italic markdown. Uses the star variant by default.- Parameters:
text- the text to format- Returns:
- the formatted text
- See Also:
italic(String, boolean)
-
underline
public static java.lang.String underline(java.lang.String text)Formats the text with underline markdown.- Parameters:
text- the text to format- Returns:
- the formatted text
-
strikethrough
public static java.lang.String strikethrough(java.lang.String text)Formats the text with strikethrough markdown.- Parameters:
text- the text to format- Returns:
- the formatted text
-
spoiler
public static java.lang.String spoiler(java.lang.String text)Formats the text with spoiler markdown.- Parameters:
text- the text to format- Returns:
- the formatted text
-
maskedLink
public static java.lang.String maskedLink(java.lang.String clickableText, java.lang.String url)Make a masked link using markdown. Note that this only works in Discord embed fields and descriptions, not in regular messages.- Parameters:
clickableText- the text that should be clickableurl- the url to redirect to when the text is clicked- Returns:
- the masked link markdown
-
code
public static java.lang.String code(java.lang.String text)Formats the text as code.- Parameters:
text- the text to format- Returns:
- the formatted text
-
codeBlock
public static java.lang.String codeBlock(java.lang.String text, java.lang.String language)Formats the text as a code block.- Parameters:
text- the text to formatlanguage- the language of the code (hint for syntax highlighting)- Returns:
- the formatted text
-
codeBlock
public static java.lang.String codeBlock(java.lang.String text)Formats the text as a code block. This overload does not specify a language parameter for syntax highlighting.- Parameters:
text- the text to format- Returns:
- the formatted text
-
quote
public static java.lang.String quote(java.lang.String text)Formats the text as a quote.- Parameters:
text- the text to format- Returns:
- the formatted text
-