@discordjs/builders 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -0
- package/README.md +28 -8
- package/dist/index.d.ts +818 -17
- package/dist/index.js +4 -21
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +4 -38
- package/dist/index.mjs.map +7 -0
- package/package.json +53 -41
- package/dist/index.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/Assertions.d.ts +0 -6
- package/dist/interactions/contextMenuCommands/Assertions.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/Assertions.js +0 -32
- package/dist/interactions/contextMenuCommands/Assertions.js.map +0 -1
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts +0 -43
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts.map +0 -1
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.js +0 -85
- package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.js.map +0 -1
- package/dist/interactions/slashCommands/Assertions.d.ts +0 -12
- package/dist/interactions/slashCommands/Assertions.d.ts.map +0 -1
- package/dist/interactions/slashCommands/Assertions.js +0 -63
- package/dist/interactions/slashCommands/Assertions.js.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +0 -58
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.js +0 -113
- package/dist/interactions/slashCommands/SlashCommandBuilder.js.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts +0 -54
- package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts.map +0 -1
- package/dist/interactions/slashCommands/SlashCommandSubcommands.js +0 -123
- package/dist/interactions/slashCommands/SlashCommandSubcommands.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.d.ts +0 -18
- package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.js +0 -58
- package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptionBase.d.ts +0 -15
- package/dist/interactions/slashCommands/mixins/CommandOptionBase.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptionBase.js +0 -48
- package/dist/interactions/slashCommands/mixins/CommandOptionBase.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.d.ts +0 -49
- package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.js +0 -71
- package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptions.d.ts +0 -54
- package/dist/interactions/slashCommands/mixins/CommandOptions.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/CommandOptions.js +0 -91
- package/dist/interactions/slashCommands/mixins/CommandOptions.js.map +0 -1
- package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts +0 -15
- package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts.map +0 -1
- package/dist/interactions/slashCommands/mixins/NameAndDescription.js +0 -42
- package/dist/interactions/slashCommands/mixins/NameAndDescription.js.map +0 -1
- package/dist/interactions/slashCommands/options/boolean.d.ts +0 -7
- package/dist/interactions/slashCommands/options/boolean.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/boolean.js +0 -18
- package/dist/interactions/slashCommands/options/boolean.js.map +0 -1
- package/dist/interactions/slashCommands/options/channel.d.ts +0 -7
- package/dist/interactions/slashCommands/options/channel.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/channel.js +0 -18
- package/dist/interactions/slashCommands/options/channel.js.map +0 -1
- package/dist/interactions/slashCommands/options/integer.d.ts +0 -7
- package/dist/interactions/slashCommands/options/integer.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/integer.js +0 -18
- package/dist/interactions/slashCommands/options/integer.js.map +0 -1
- package/dist/interactions/slashCommands/options/mentionable.d.ts +0 -7
- package/dist/interactions/slashCommands/options/mentionable.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/mentionable.js +0 -18
- package/dist/interactions/slashCommands/options/mentionable.js.map +0 -1
- package/dist/interactions/slashCommands/options/number.d.ts +0 -7
- package/dist/interactions/slashCommands/options/number.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/number.js +0 -18
- package/dist/interactions/slashCommands/options/number.js.map +0 -1
- package/dist/interactions/slashCommands/options/role.d.ts +0 -7
- package/dist/interactions/slashCommands/options/role.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/role.js +0 -18
- package/dist/interactions/slashCommands/options/role.js.map +0 -1
- package/dist/interactions/slashCommands/options/string.d.ts +0 -7
- package/dist/interactions/slashCommands/options/string.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/string.js +0 -18
- package/dist/interactions/slashCommands/options/string.js.map +0 -1
- package/dist/interactions/slashCommands/options/user.d.ts +0 -7
- package/dist/interactions/slashCommands/options/user.d.ts.map +0 -1
- package/dist/interactions/slashCommands/options/user.js +0 -18
- package/dist/interactions/slashCommands/options/user.js.map +0 -1
- package/dist/messages/embed/Assertions.d.ts +0 -23
- package/dist/messages/embed/Assertions.d.ts.map +0 -1
- package/dist/messages/embed/Assertions.js +0 -26
- package/dist/messages/embed/Assertions.js.map +0 -1
- package/dist/messages/embed/Embed.d.ts +0 -140
- package/dist/messages/embed/Embed.d.ts.map +0 -1
- package/dist/messages/embed/Embed.js +0 -300
- package/dist/messages/embed/Embed.js.map +0 -1
- package/dist/messages/formatters.d.ts +0 -198
- package/dist/messages/formatters.d.ts.map +0 -1
- package/dist/messages/formatters.js +0 -181
- package/dist/messages/formatters.js.map +0 -1
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Faces = exports.TimestampStyles = exports.time = exports.formatEmoji = exports.roleMention = exports.channelMention = exports.memberNicknameMention = exports.userMention = exports.spoiler = exports.hyperlink = exports.hideLinkEmbed = exports.blockQuote = exports.quote = exports.strikethrough = exports.underscore = exports.bold = exports.italic = exports.inlineCode = exports.codeBlock = void 0;
|
|
4
|
-
function codeBlock(language, content) {
|
|
5
|
-
return typeof content === 'undefined' ? `\`\`\`\n${language}\`\`\`` : `\`\`\`${language}\n${content}\`\`\``;
|
|
6
|
-
}
|
|
7
|
-
exports.codeBlock = codeBlock;
|
|
8
|
-
/**
|
|
9
|
-
* Wraps the content inside \`backticks\`, which formats it as inline code.
|
|
10
|
-
* @param content The content to wrap.
|
|
11
|
-
*/
|
|
12
|
-
function inlineCode(content) {
|
|
13
|
-
return `\`${content}\``;
|
|
14
|
-
}
|
|
15
|
-
exports.inlineCode = inlineCode;
|
|
16
|
-
/**
|
|
17
|
-
* Formats the content into italic text.
|
|
18
|
-
* @param content The content to wrap.
|
|
19
|
-
*/
|
|
20
|
-
function italic(content) {
|
|
21
|
-
return `_${content}_`;
|
|
22
|
-
}
|
|
23
|
-
exports.italic = italic;
|
|
24
|
-
/**
|
|
25
|
-
* Formats the content into bold text.
|
|
26
|
-
* @param content The content to wrap.
|
|
27
|
-
*/
|
|
28
|
-
function bold(content) {
|
|
29
|
-
return `**${content}**`;
|
|
30
|
-
}
|
|
31
|
-
exports.bold = bold;
|
|
32
|
-
/**
|
|
33
|
-
* Formats the content into underscored text.
|
|
34
|
-
* @param content The content to wrap.
|
|
35
|
-
*/
|
|
36
|
-
function underscore(content) {
|
|
37
|
-
return `__${content}__`;
|
|
38
|
-
}
|
|
39
|
-
exports.underscore = underscore;
|
|
40
|
-
/**
|
|
41
|
-
* Formats the content into strike-through text.
|
|
42
|
-
* @param content The content to wrap.
|
|
43
|
-
*/
|
|
44
|
-
function strikethrough(content) {
|
|
45
|
-
return `~~${content}~~`;
|
|
46
|
-
}
|
|
47
|
-
exports.strikethrough = strikethrough;
|
|
48
|
-
/**
|
|
49
|
-
* Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
|
|
50
|
-
* @param content The content to wrap.
|
|
51
|
-
*/
|
|
52
|
-
function quote(content) {
|
|
53
|
-
return `> ${content}`;
|
|
54
|
-
}
|
|
55
|
-
exports.quote = quote;
|
|
56
|
-
/**
|
|
57
|
-
* Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.
|
|
58
|
-
* @param content The content to wrap.
|
|
59
|
-
*/
|
|
60
|
-
function blockQuote(content) {
|
|
61
|
-
return `>>> ${content}`;
|
|
62
|
-
}
|
|
63
|
-
exports.blockQuote = blockQuote;
|
|
64
|
-
function hideLinkEmbed(url) {
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
66
|
-
return `<${url}>`;
|
|
67
|
-
}
|
|
68
|
-
exports.hideLinkEmbed = hideLinkEmbed;
|
|
69
|
-
function hyperlink(content, url, title) {
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
71
|
-
return title ? `[${content}](${url} "${title}")` : `[${content}](${url})`;
|
|
72
|
-
}
|
|
73
|
-
exports.hyperlink = hyperlink;
|
|
74
|
-
/**
|
|
75
|
-
* Wraps the content inside spoiler (hidden text).
|
|
76
|
-
* @param content The content to wrap.
|
|
77
|
-
*/
|
|
78
|
-
function spoiler(content) {
|
|
79
|
-
return `||${content}||`;
|
|
80
|
-
}
|
|
81
|
-
exports.spoiler = spoiler;
|
|
82
|
-
/**
|
|
83
|
-
* Formats a user ID into a user mention.
|
|
84
|
-
* @param userId The user ID to format.
|
|
85
|
-
*/
|
|
86
|
-
function userMention(userId) {
|
|
87
|
-
return `<@${userId}>`;
|
|
88
|
-
}
|
|
89
|
-
exports.userMention = userMention;
|
|
90
|
-
/**
|
|
91
|
-
* Formats a user ID into a member-nickname mention.
|
|
92
|
-
* @param memberId The user ID to format.
|
|
93
|
-
*/
|
|
94
|
-
function memberNicknameMention(memberId) {
|
|
95
|
-
return `<@!${memberId}>`;
|
|
96
|
-
}
|
|
97
|
-
exports.memberNicknameMention = memberNicknameMention;
|
|
98
|
-
/**
|
|
99
|
-
* Formats a channel ID into a channel mention.
|
|
100
|
-
* @param channelId The channel ID to format.
|
|
101
|
-
*/
|
|
102
|
-
function channelMention(channelId) {
|
|
103
|
-
return `<#${channelId}>`;
|
|
104
|
-
}
|
|
105
|
-
exports.channelMention = channelMention;
|
|
106
|
-
/**
|
|
107
|
-
* Formats a role ID into a role mention.
|
|
108
|
-
* @param roleId The role ID to format.
|
|
109
|
-
*/
|
|
110
|
-
function roleMention(roleId) {
|
|
111
|
-
return `<@&${roleId}>`;
|
|
112
|
-
}
|
|
113
|
-
exports.roleMention = roleMention;
|
|
114
|
-
/**
|
|
115
|
-
* Formats an emoji ID into a fully qualified emoji identifier
|
|
116
|
-
* @param emojiId The emoji ID to format.
|
|
117
|
-
* @param animated Whether the emoji is animated or not. Defaults to `false`
|
|
118
|
-
*/
|
|
119
|
-
function formatEmoji(emojiId, animated = false) {
|
|
120
|
-
return `<${animated ? 'a' : ''}:_:${emojiId}>`;
|
|
121
|
-
}
|
|
122
|
-
exports.formatEmoji = formatEmoji;
|
|
123
|
-
function time(timeOrSeconds, style) {
|
|
124
|
-
if (typeof timeOrSeconds !== 'number') {
|
|
125
|
-
timeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1000);
|
|
126
|
-
}
|
|
127
|
-
return typeof style === 'string' ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;
|
|
128
|
-
}
|
|
129
|
-
exports.time = time;
|
|
130
|
-
/**
|
|
131
|
-
* The [message formatting timestamp styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.
|
|
132
|
-
*/
|
|
133
|
-
exports.TimestampStyles = {
|
|
134
|
-
/**
|
|
135
|
-
* Short time format, consisting of hours and minutes, e.g. 16:20.
|
|
136
|
-
*/
|
|
137
|
-
ShortTime: 't',
|
|
138
|
-
/**
|
|
139
|
-
* Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
|
|
140
|
-
*/
|
|
141
|
-
LongTime: 'T',
|
|
142
|
-
/**
|
|
143
|
-
* Short date format, consisting of day, month, and year, e.g. 20/04/2021.
|
|
144
|
-
*/
|
|
145
|
-
ShortDate: 'd',
|
|
146
|
-
/**
|
|
147
|
-
* Long date format, consisting of day, month, and year, e.g. 20 April 2021.
|
|
148
|
-
*/
|
|
149
|
-
LongDate: 'D',
|
|
150
|
-
/**
|
|
151
|
-
* Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
|
|
152
|
-
*/
|
|
153
|
-
ShortDateTime: 'f',
|
|
154
|
-
/**
|
|
155
|
-
* Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
|
|
156
|
-
*/
|
|
157
|
-
LongDateTime: 'F',
|
|
158
|
-
/**
|
|
159
|
-
* Relative time format, consisting of a relative duration format, e.g. 2 months ago.
|
|
160
|
-
*/
|
|
161
|
-
RelativeTime: 'R',
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* An enum with all the available faces from Discord's native slash commands
|
|
165
|
-
*/
|
|
166
|
-
var Faces;
|
|
167
|
-
(function (Faces) {
|
|
168
|
-
/**
|
|
169
|
-
* ¯\\_(ツ)\\_/¯
|
|
170
|
-
*/
|
|
171
|
-
Faces["Shrug"] = "\u00AF\\_(\u30C4)\\_/\u00AF";
|
|
172
|
-
/**
|
|
173
|
-
* (╯°□°)╯︵ ┻━┻
|
|
174
|
-
*/
|
|
175
|
-
Faces["Tableflip"] = "(\u256F\u00B0\u25A1\u00B0\uFF09\u256F\uFE35 \u253B\u2501\u253B";
|
|
176
|
-
/**
|
|
177
|
-
* ┬─┬ ノ( ゜-゜ノ)
|
|
178
|
-
*/
|
|
179
|
-
Faces["Unflip"] = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)";
|
|
180
|
-
})(Faces = exports.Faces || (exports.Faces = {}));
|
|
181
|
-
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"/","sources":["messages/formatters.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Snowflake } from 'discord-api-types/globals';\nimport type { URL } from 'url';\n\n/**\n * Wraps the content inside a codeblock with no language.\n * @param content The content to wrap.\n */\nexport function codeBlock<C extends string>(content: C): `\\`\\`\\`\\n${C}\\`\\`\\``;\n\n/**\n * Wraps the content inside a codeblock with the specified language.\n * @param language The language for the codeblock.\n * @param content The content to wrap.\n */\nexport function codeBlock<L extends string, C extends string>(language: L, content: C): `\\`\\`\\`${L}\\n${C}\\`\\`\\``;\nexport function codeBlock(language: string, content?: string): string {\n\treturn typeof content === 'undefined' ? `\\`\\`\\`\\n${language}\\`\\`\\`` : `\\`\\`\\`${language}\\n${content}\\`\\`\\``;\n}\n\n/**\n * Wraps the content inside \\`backticks\\`, which formats it as inline code.\n * @param content The content to wrap.\n */\nexport function inlineCode<C extends string>(content: C): `\\`${C}\\`` {\n\treturn `\\`${content}\\``;\n}\n\n/**\n * Formats the content into italic text.\n * @param content The content to wrap.\n */\nexport function italic<C extends string>(content: C): `_${C}_` {\n\treturn `_${content}_`;\n}\n\n/**\n * Formats the content into bold text.\n * @param content The content to wrap.\n */\nexport function bold<C extends string>(content: C): `**${C}**` {\n\treturn `**${content}**`;\n}\n\n/**\n * Formats the content into underscored text.\n * @param content The content to wrap.\n */\nexport function underscore<C extends string>(content: C): `__${C}__` {\n\treturn `__${content}__`;\n}\n\n/**\n * Formats the content into strike-through text.\n * @param content The content to wrap.\n */\nexport function strikethrough<C extends string>(content: C): `~~${C}~~` {\n\treturn `~~${content}~~`;\n}\n\n/**\n * Formats the content into a quote. This needs to be at the start of the line for Discord to format it.\n * @param content The content to wrap.\n */\nexport function quote<C extends string>(content: C): `> ${C}` {\n\treturn `> ${content}`;\n}\n\n/**\n * Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.\n * @param content The content to wrap.\n */\nexport function blockQuote<C extends string>(content: C): `>>> ${C}` {\n\treturn `>>> ${content}`;\n}\n\n/**\n * Wraps the URL into `<>`, which stops it from embedding.\n * @param url The URL to wrap.\n */\nexport function hideLinkEmbed<C extends string>(url: C): `<${C}>`;\n\n/**\n * Wraps the URL into `<>`, which stops it from embedding.\n * @param url The URL to wrap.\n */\nexport function hideLinkEmbed(url: URL): `<${string}>`;\nexport function hideLinkEmbed(url: string | URL) {\n\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\treturn `<${url}>`;\n}\n\n/**\n * Formats the content and the URL into a masked URL.\n * @param content The content to display.\n * @param url The URL the content links to.\n */\nexport function hyperlink<C extends string>(content: C, url: URL): `[${C}](${string})`;\n\n/**\n * Formats the content and the URL into a masked URL.\n * @param content The content to display.\n * @param url The URL the content links to.\n */\nexport function hyperlink<C extends string, U extends string>(content: C, url: U): `[${C}](${U})`;\n\n/**\n * Formats the content and the URL into a masked URL.\n * @param content The content to display.\n * @param url The URL the content links to.\n * @param title The title shown when hovering on the masked link.\n */\nexport function hyperlink<C extends string, T extends string>(\n\tcontent: C,\n\turl: URL,\n\ttitle: T,\n): `[${C}](${string} \"${T}\")`;\n\n/**\n * Formats the content and the URL into a masked URL.\n * @param content The content to display.\n * @param url The URL the content links to.\n * @param title The title shown when hovering on the masked link.\n */\nexport function hyperlink<C extends string, U extends string, T extends string>(\n\tcontent: C,\n\turl: U,\n\ttitle: T,\n): `[${C}](${U} \"${T}\")`;\nexport function hyperlink(content: string, url: string | URL, title?: string) {\n\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\treturn title ? `[${content}](${url} \"${title}\")` : `[${content}](${url})`;\n}\n\n/**\n * Wraps the content inside spoiler (hidden text).\n * @param content The content to wrap.\n */\nexport function spoiler<C extends string>(content: C): `||${C}||` {\n\treturn `||${content}||`;\n}\n\n/**\n * Formats a user ID into a user mention.\n * @param userId The user ID to format.\n */\nexport function userMention<C extends Snowflake>(userId: C): `<@${C}>` {\n\treturn `<@${userId}>`;\n}\n\n/**\n * Formats a user ID into a member-nickname mention.\n * @param memberId The user ID to format.\n */\nexport function memberNicknameMention<C extends Snowflake>(memberId: C): `<@!${C}>` {\n\treturn `<@!${memberId}>`;\n}\n\n/**\n * Formats a channel ID into a channel mention.\n * @param channelId The channel ID to format.\n */\nexport function channelMention<C extends Snowflake>(channelId: C): `<#${C}>` {\n\treturn `<#${channelId}>`;\n}\n\n/**\n * Formats a role ID into a role mention.\n * @param roleId The role ID to format.\n */\nexport function roleMention<C extends Snowflake>(roleId: C): `<@&${C}>` {\n\treturn `<@&${roleId}>`;\n}\n\n/**\n * Formats an emoji ID into a fully qualified emoji identifier\n * @param emojiId The emoji ID to format.\n */\nexport function formatEmoji<C extends Snowflake>(emojiId: C, animated?: false): `<:_:${C}>`;\n\n/**\n * Formats an emoji ID into a fully qualified emoji identifier\n * @param emojiId The emoji ID to format.\n * @param animated Whether the emoji is animated or not. Defaults to `false`\n */\nexport function formatEmoji<C extends Snowflake>(emojiId: C, animated?: true): `<a:_:${C}>`;\n\n/**\n * Formats an emoji ID into a fully qualified emoji identifier\n * @param emojiId The emoji ID to format.\n * @param animated Whether the emoji is animated or not. Defaults to `false`\n */\nexport function formatEmoji<C extends Snowflake>(emojiId: C, animated = false): `<a:_:${C}>` | `<:_:${C}>` {\n\treturn `<${animated ? 'a' : ''}:_:${emojiId}>`;\n}\n\n/**\n * Formats a date into a short date-time string.\n * @param date The date to format, defaults to the current time.\n */\nexport function time(date?: Date): `<t:${bigint}>`;\n\n/**\n * Formats a date given a format style.\n * @param date The date to format.\n * @param style The style to use.\n */\nexport function time<S extends TimestampStylesString>(date: Date, style: S): `<t:${bigint}:${S}>`;\n\n/**\n * Formats the given timestamp into a short date-time string.\n * @param seconds The time to format, represents an UNIX timestamp in seconds.\n */\nexport function time<C extends number>(seconds: C): `<t:${C}>`;\n\n/**\n * Formats the given timestamp into a short date-time string.\n * @param seconds The time to format, represents an UNIX timestamp in seconds.\n * @param style The style to use.\n */\nexport function time<C extends number, S extends TimestampStylesString>(seconds: C, style: S): `<t:${C}:${S}>`;\nexport function time(timeOrSeconds?: number | Date, style?: TimestampStylesString): string {\n\tif (typeof timeOrSeconds !== 'number') {\n\t\ttimeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1000);\n\t}\n\n\treturn typeof style === 'string' ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;\n}\n\n/**\n * The [message formatting timestamp styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.\n */\nexport const TimestampStyles = {\n\t/**\n\t * Short time format, consisting of hours and minutes, e.g. 16:20.\n\t */\n\tShortTime: 't',\n\n\t/**\n\t * Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.\n\t */\n\tLongTime: 'T',\n\n\t/**\n\t * Short date format, consisting of day, month, and year, e.g. 20/04/2021.\n\t */\n\tShortDate: 'd',\n\n\t/**\n\t * Long date format, consisting of day, month, and year, e.g. 20 April 2021.\n\t */\n\tLongDate: 'D',\n\n\t/**\n\t * Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.\n\t */\n\tShortDateTime: 'f',\n\n\t/**\n\t * Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.\n\t */\n\tLongDateTime: 'F',\n\n\t/**\n\t * Relative time format, consisting of a relative duration format, e.g. 2 months ago.\n\t */\n\tRelativeTime: 'R',\n} as const;\n\n/**\n * The possible values, see {@link TimestampStyles} for more information.\n */\nexport type TimestampStylesString = typeof TimestampStyles[keyof typeof TimestampStyles];\n\n/**\n * An enum with all the available faces from Discord's native slash commands\n */\nexport enum Faces {\n\t/**\n\t * ¯\\\\_(ツ)\\\\_/¯\n\t */\n\tShrug = '¯\\\\_(ツ)\\\\_/¯',\n\n\t/**\n\t * (╯°□°)╯︵ ┻━┻\n\t */\n\tTableflip = '(╯°□°)╯︵ ┻━┻',\n\n\t/**\n\t * ┬─┬ ノ( ゜-゜ノ)\n\t */\n\tUnflip = '┬─┬ ノ( ゜-゜ノ)',\n}\n"]}
|