blob: 55a6666522dbd9d48426d964be6a1f0b838998d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
import { type CodeBlockLang } from '#lib';
import { Formatters, Util } from 'discord.js';
/**
* Formats and escapes content for formatting
*/
export class Format {
/**
* Wraps the content inside a codeblock with no language.
* @param content The content to wrap.
*/
public static codeBlock(content: string): string;
/**
* Wraps the content inside a codeblock with the specified language.
* @param language The language for the codeblock.
* @param content The content to wrap.
*/
public static codeBlock(language: CodeBlockLang, content: string): string;
public static codeBlock(languageOrContent: string, content?: string): string {
return typeof content === 'undefined'
? Formatters.codeBlock(Util.escapeCodeBlock(languageOrContent))
: Formatters.codeBlock(languageOrContent, Util.escapeCodeBlock(languageOrContent));
}
/**
* Wraps the content inside \`backticks\`, which formats it as inline code.
* @param content The content to wrap.
*/
public static inlineCode(content: string): string {
return Formatters.inlineCode(Util.escapeInlineCode(content));
}
/**
* Formats the content into italic text.
* @param content The content to wrap.
*/
public static italic(content: string): string {
return Formatters.italic(Util.escapeItalic(content));
}
/**
* Formats the content into bold text.
* @param content The content to wrap.
*/
public static bold(content: string): string {
return Formatters.bold(Util.escapeBold(content));
}
/**
* Formats the content into underscored text.
* @param content The content to wrap.
*/
public static underscore(content: string): string {
return Formatters.underscore(Util.escapeUnderline(content));
}
/**
* Formats the content into strike-through text.
* @param content The content to wrap.
*/
public static strikethrough(content: string): string {
return Formatters.strikethrough(Util.escapeStrikethrough(content));
}
/**
* Wraps the content inside spoiler (hidden text).
* @param content The content to wrap.
*/
public static spoiler(content: string): string {
return Formatters.spoiler(Util.escapeSpoiler(content));
}
}
|