@discordjs/formatters 1.0.0-dev.1690416583-8f4256d.0 → 1.0.0-dev.1732752782-e89c6b66a
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/README.md +2 -1
- package/dist/index.d.mts +253 -80
- package/dist/index.d.ts +253 -80
- package/dist/index.js +116 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +44 -33
- package/CHANGELOG.md +0 -42
package/README.md
CHANGED
|
@@ -23,12 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
26
|
-
**Node.js
|
|
26
|
+
**Node.js 20 or newer is required.**
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
29
|
npm install @discordjs/formatters
|
|
30
30
|
yarn add @discordjs/formatters
|
|
31
31
|
pnpm add @discordjs/formatters
|
|
32
|
+
bun add @discordjs/formatters
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
## Example usage
|
package/dist/index.d.mts
CHANGED
|
@@ -173,77 +173,85 @@ declare function escapeMaskedLink(text: string): string;
|
|
|
173
173
|
/**
|
|
174
174
|
* Wraps the content inside a code block with no language.
|
|
175
175
|
*
|
|
176
|
-
* @typeParam
|
|
176
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
177
177
|
* @param content - The content to wrap
|
|
178
178
|
*/
|
|
179
|
-
declare function codeBlock<
|
|
179
|
+
declare function codeBlock<Content extends string>(content: Content): `\`\`\`\n${Content}\n\`\`\``;
|
|
180
180
|
/**
|
|
181
181
|
* Wraps the content inside a code block with the specified language.
|
|
182
182
|
*
|
|
183
|
-
* @typeParam
|
|
184
|
-
* @typeParam
|
|
183
|
+
* @typeParam Language - This is inferred by the supplied language
|
|
184
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
185
185
|
* @param language - The language for the code block
|
|
186
186
|
* @param content - The content to wrap
|
|
187
187
|
*/
|
|
188
|
-
declare function codeBlock<
|
|
188
|
+
declare function codeBlock<Language extends string, Content extends string>(language: Language, content: Content): `\`\`\`${Language}\n${Content}\n\`\`\``;
|
|
189
189
|
/**
|
|
190
190
|
* Wraps the content inside \`backticks\` which formats it as inline code.
|
|
191
191
|
*
|
|
192
|
-
* @typeParam
|
|
192
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
193
193
|
* @param content - The content to wrap
|
|
194
194
|
*/
|
|
195
|
-
declare function inlineCode<
|
|
195
|
+
declare function inlineCode<Content extends string>(content: Content): `\`${Content}\``;
|
|
196
196
|
/**
|
|
197
197
|
* Formats the content into italic text.
|
|
198
198
|
*
|
|
199
|
-
* @typeParam
|
|
199
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
200
200
|
* @param content - The content to wrap
|
|
201
201
|
*/
|
|
202
|
-
declare function italic<
|
|
202
|
+
declare function italic<Content extends string>(content: Content): `_${Content}_`;
|
|
203
203
|
/**
|
|
204
204
|
* Formats the content into bold text.
|
|
205
205
|
*
|
|
206
|
-
* @typeParam
|
|
206
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
207
207
|
* @param content - The content to wrap
|
|
208
208
|
*/
|
|
209
|
-
declare function bold<
|
|
209
|
+
declare function bold<Content extends string>(content: Content): `**${Content}**`;
|
|
210
210
|
/**
|
|
211
211
|
* Formats the content into underscored text.
|
|
212
212
|
*
|
|
213
|
-
* @typeParam
|
|
213
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
214
214
|
* @param content - The content to wrap
|
|
215
|
+
* @deprecated Use {@link underline} instead.
|
|
215
216
|
*/
|
|
216
|
-
declare function underscore<
|
|
217
|
+
declare function underscore<Content extends string>(content: Content): `__${Content}__`;
|
|
218
|
+
/**
|
|
219
|
+
* Formats the content into underlined text.
|
|
220
|
+
*
|
|
221
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
222
|
+
* @param content - The content to wrap
|
|
223
|
+
*/
|
|
224
|
+
declare function underline<Content extends string>(content: Content): `__${Content}__`;
|
|
217
225
|
/**
|
|
218
226
|
* Formats the content into strike-through text.
|
|
219
227
|
*
|
|
220
|
-
* @typeParam
|
|
228
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
221
229
|
* @param content - The content to wrap
|
|
222
230
|
*/
|
|
223
|
-
declare function strikethrough<
|
|
231
|
+
declare function strikethrough<Content extends string>(content: Content): `~~${Content}~~`;
|
|
224
232
|
/**
|
|
225
233
|
* Formats the content into a quote.
|
|
226
234
|
*
|
|
227
235
|
* @remarks This needs to be at the start of the line for Discord to format it.
|
|
228
|
-
* @typeParam
|
|
236
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
229
237
|
* @param content - The content to wrap
|
|
230
238
|
*/
|
|
231
|
-
declare function quote<
|
|
239
|
+
declare function quote<Content extends string>(content: Content): `> ${Content}`;
|
|
232
240
|
/**
|
|
233
241
|
* Formats the content into a block quote.
|
|
234
242
|
*
|
|
235
243
|
* @remarks This needs to be at the start of the line for Discord to format it.
|
|
236
|
-
* @typeParam
|
|
244
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
237
245
|
* @param content - The content to wrap
|
|
238
246
|
*/
|
|
239
|
-
declare function blockQuote<
|
|
247
|
+
declare function blockQuote<Content extends string>(content: Content): `>>> ${Content}`;
|
|
240
248
|
/**
|
|
241
249
|
* Wraps the URL into `<>` which stops it from embedding.
|
|
242
250
|
*
|
|
243
|
-
* @typeParam
|
|
251
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
244
252
|
* @param url - The URL to wrap
|
|
245
253
|
*/
|
|
246
|
-
declare function hideLinkEmbed<
|
|
254
|
+
declare function hideLinkEmbed<Content extends string>(url: Content): `<${Content}>`;
|
|
247
255
|
/**
|
|
248
256
|
* Wraps the URL into `<>` which stops it from embedding.
|
|
249
257
|
*
|
|
@@ -253,161 +261,281 @@ declare function hideLinkEmbed(url: URL): `<${string}>`;
|
|
|
253
261
|
/**
|
|
254
262
|
* Formats the content and the URL into a masked URL.
|
|
255
263
|
*
|
|
256
|
-
* @typeParam
|
|
264
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
257
265
|
* @param content - The content to display
|
|
258
266
|
* @param url - The URL the content links to
|
|
259
267
|
*/
|
|
260
|
-
declare function hyperlink<
|
|
268
|
+
declare function hyperlink<Content extends string>(content: Content, url: URL): `[${Content}](${string})`;
|
|
261
269
|
/**
|
|
262
270
|
* Formats the content and the URL into a masked URL.
|
|
263
271
|
*
|
|
264
|
-
* @typeParam
|
|
265
|
-
* @typeParam
|
|
272
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
273
|
+
* @typeParam Url - This is inferred by the supplied URL
|
|
266
274
|
* @param content - The content to display
|
|
267
275
|
* @param url - The URL the content links to
|
|
268
276
|
*/
|
|
269
|
-
declare function hyperlink<
|
|
277
|
+
declare function hyperlink<Content extends string, Url extends string>(content: Content, url: Url): `[${Content}](${Url})`;
|
|
270
278
|
/**
|
|
271
279
|
* Formats the content and the URL into a masked URL with a custom tooltip.
|
|
272
280
|
*
|
|
273
|
-
* @typeParam
|
|
274
|
-
* @typeParam
|
|
281
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
282
|
+
* @typeParam Title - This is inferred by the supplied title
|
|
275
283
|
* @param content - The content to display
|
|
276
284
|
* @param url - The URL the content links to
|
|
277
285
|
* @param title - The title shown when hovering on the masked link
|
|
278
286
|
*/
|
|
279
|
-
declare function hyperlink<
|
|
287
|
+
declare function hyperlink<Content extends string, Title extends string>(content: Content, url: URL, title: Title): `[${Content}](${string} "${Title}")`;
|
|
280
288
|
/**
|
|
281
289
|
* Formats the content and the URL into a masked URL with a custom tooltip.
|
|
282
290
|
*
|
|
283
|
-
* @typeParam
|
|
284
|
-
* @typeParam
|
|
285
|
-
* @typeParam
|
|
291
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
292
|
+
* @typeParam Url - This is inferred by the supplied URL
|
|
293
|
+
* @typeParam Title - This is inferred by the supplied title
|
|
286
294
|
* @param content - The content to display
|
|
287
295
|
* @param url - The URL the content links to
|
|
288
296
|
* @param title - The title shown when hovering on the masked link
|
|
289
297
|
*/
|
|
290
|
-
declare function hyperlink<
|
|
298
|
+
declare function hyperlink<Content extends string, Url extends string, Title extends string>(content: Content, url: Url, title: Title): `[${Content}](${Url} "${Title}")`;
|
|
291
299
|
/**
|
|
292
300
|
* Formats the content into a spoiler.
|
|
293
301
|
*
|
|
294
|
-
* @typeParam
|
|
302
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
295
303
|
* @param content - The content to wrap
|
|
296
304
|
*/
|
|
297
|
-
declare function spoiler<
|
|
305
|
+
declare function spoiler<Content extends string>(content: Content): `||${Content}||`;
|
|
298
306
|
/**
|
|
299
307
|
* Formats a user id into a user mention.
|
|
300
308
|
*
|
|
301
|
-
* @typeParam
|
|
309
|
+
* @typeParam UserId - This is inferred by the supplied user id
|
|
302
310
|
* @param userId - The user id to format
|
|
303
311
|
*/
|
|
304
|
-
declare function userMention<
|
|
312
|
+
declare function userMention<UserId extends Snowflake>(userId: UserId): `<@${UserId}>`;
|
|
305
313
|
/**
|
|
306
314
|
* Formats a channel id into a channel mention.
|
|
307
315
|
*
|
|
308
|
-
* @typeParam
|
|
316
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
309
317
|
* @param channelId - The channel id to format
|
|
310
318
|
*/
|
|
311
|
-
declare function channelMention<
|
|
319
|
+
declare function channelMention<ChannelId extends Snowflake>(channelId: ChannelId): `<#${ChannelId}>`;
|
|
312
320
|
/**
|
|
313
321
|
* Formats a role id into a role mention.
|
|
314
322
|
*
|
|
315
|
-
* @typeParam
|
|
323
|
+
* @typeParam RoleId - This is inferred by the supplied role id
|
|
316
324
|
* @param roleId - The role id to format
|
|
317
325
|
*/
|
|
318
|
-
declare function roleMention<
|
|
326
|
+
declare function roleMention<RoleId extends Snowflake>(roleId: RoleId): `<@&${RoleId}>`;
|
|
327
|
+
/**
|
|
328
|
+
* Formats a role id into a linked role mention.
|
|
329
|
+
*
|
|
330
|
+
* @typeParam RoleId - This is inferred by the supplied role id
|
|
331
|
+
* @param roleId - The role id to format
|
|
332
|
+
*/
|
|
333
|
+
declare function linkedRoleMention<RoleId extends Snowflake>(roleId: RoleId): `<id:linked-roles:${RoleId}>`;
|
|
319
334
|
/**
|
|
320
335
|
* Formats an application command name, subcommand group name, subcommand name, and id into an application command mention.
|
|
321
336
|
*
|
|
322
|
-
* @typeParam
|
|
323
|
-
* @typeParam
|
|
324
|
-
* @typeParam
|
|
325
|
-
* @typeParam
|
|
337
|
+
* @typeParam CommandName - This is inferred by the supplied command name
|
|
338
|
+
* @typeParam SubcommandGroupName - This is inferred by the supplied subcommand group name
|
|
339
|
+
* @typeParam SubcommandName - This is inferred by the supplied subcommand name
|
|
340
|
+
* @typeParam CommandId - This is inferred by the supplied command id
|
|
326
341
|
* @param commandName - The application command name to format
|
|
327
342
|
* @param subcommandGroupName - The subcommand group name to format
|
|
328
343
|
* @param subcommandName - The subcommand name to format
|
|
329
344
|
* @param commandId - The application command id to format
|
|
330
345
|
*/
|
|
331
|
-
declare function chatInputApplicationCommandMention<
|
|
346
|
+
declare function chatInputApplicationCommandMention<CommandName extends string, SubcommandGroupName extends string, SubcommandName extends string, CommandId extends Snowflake>(commandName: CommandName, subcommandGroupName: SubcommandGroupName, subcommandName: SubcommandName, commandId: CommandId): `</${CommandName} ${SubcommandGroupName} ${SubcommandName}:${CommandId}>`;
|
|
332
347
|
/**
|
|
333
348
|
* Formats an application command name, subcommand name, and id into an application command mention.
|
|
334
349
|
*
|
|
335
|
-
* @typeParam
|
|
336
|
-
* @typeParam
|
|
337
|
-
* @typeParam
|
|
350
|
+
* @typeParam CommandName - This is inferred by the supplied command name
|
|
351
|
+
* @typeParam SubcommandName - This is inferred by the supplied subcommand name
|
|
352
|
+
* @typeParam CommandId - This is inferred by the supplied command id
|
|
338
353
|
* @param commandName - The application command name to format
|
|
339
354
|
* @param subcommandName - The subcommand name to format
|
|
340
355
|
* @param commandId - The application command id to format
|
|
341
356
|
*/
|
|
342
|
-
declare function chatInputApplicationCommandMention<
|
|
357
|
+
declare function chatInputApplicationCommandMention<CommandName extends string, SubcommandName extends string, CommandId extends Snowflake>(commandName: CommandName, subcommandName: SubcommandName, commandId: CommandId): `</${CommandName} ${SubcommandName}:${CommandId}>`;
|
|
343
358
|
/**
|
|
344
359
|
* Formats an application command name and id into an application command mention.
|
|
345
360
|
*
|
|
346
|
-
* @typeParam
|
|
347
|
-
* @typeParam
|
|
361
|
+
* @typeParam CommandName - This is inferred by the supplied command name
|
|
362
|
+
* @typeParam CommandId - This is inferred by the supplied command id
|
|
348
363
|
* @param commandName - The application command name to format
|
|
349
364
|
* @param commandId - The application command id to format
|
|
350
365
|
*/
|
|
351
|
-
declare function chatInputApplicationCommandMention<
|
|
366
|
+
declare function chatInputApplicationCommandMention<CommandName extends string, CommandId extends Snowflake>(commandName: CommandName, commandId: CommandId): `</${CommandName}:${CommandId}>`;
|
|
352
367
|
/**
|
|
353
368
|
* Formats a non-animated emoji id into a fully qualified emoji identifier.
|
|
354
369
|
*
|
|
355
|
-
* @typeParam
|
|
370
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
356
371
|
* @param emojiId - The emoji id to format
|
|
357
372
|
*/
|
|
358
|
-
declare function formatEmoji<
|
|
373
|
+
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: false): `<:emoji:${EmojiId}>`;
|
|
359
374
|
/**
|
|
360
375
|
* Formats an animated emoji id into a fully qualified emoji identifier.
|
|
361
376
|
*
|
|
362
|
-
* @typeParam
|
|
377
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
363
378
|
* @param emojiId - The emoji id to format
|
|
364
379
|
* @param animated - Whether the emoji is animated
|
|
365
380
|
*/
|
|
366
|
-
declare function formatEmoji<
|
|
381
|
+
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: true): `<a:emoji:${EmojiId}>`;
|
|
367
382
|
/**
|
|
368
383
|
* Formats an emoji id into a fully qualified emoji identifier.
|
|
369
384
|
*
|
|
370
|
-
* @typeParam
|
|
385
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
371
386
|
* @param emojiId - The emoji id to format
|
|
372
387
|
* @param animated - Whether the emoji is animated
|
|
373
388
|
*/
|
|
374
|
-
declare function formatEmoji<
|
|
389
|
+
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: boolean): `<:emoji:${EmojiId}>` | `<a:emoji:${EmojiId}>`;
|
|
390
|
+
/**
|
|
391
|
+
* Formats a non-animated emoji id and name into a fully qualified emoji identifier.
|
|
392
|
+
*
|
|
393
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
394
|
+
* @typeParam EmojiName - This is inferred by the supplied name
|
|
395
|
+
* @param options - The options for formatting an emoji
|
|
396
|
+
*/
|
|
397
|
+
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName> & {
|
|
398
|
+
animated: true;
|
|
399
|
+
}): `<a:${EmojiName}:${EmojiId}>`;
|
|
400
|
+
/**
|
|
401
|
+
* Formats an animated emoji id and name into a fully qualified emoji identifier.
|
|
402
|
+
*
|
|
403
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
404
|
+
* @typeParam EmojiName - This is inferred by the supplied name
|
|
405
|
+
* @param options - The options for formatting an emoji
|
|
406
|
+
*/
|
|
407
|
+
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName> & {
|
|
408
|
+
animated?: false;
|
|
409
|
+
}): `<:${EmojiName}:${EmojiId}>`;
|
|
410
|
+
/**
|
|
411
|
+
* Formats an emoji id and name into a fully qualified emoji identifier.
|
|
412
|
+
*
|
|
413
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
414
|
+
* @typeParam EmojiName - This is inferred by the supplied emoji name
|
|
415
|
+
* @param options - The options for formatting an emoji
|
|
416
|
+
*/
|
|
417
|
+
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName>): `<:${EmojiName}:${EmojiId}>` | `<a:${EmojiName}:${EmojiId}>`;
|
|
418
|
+
/**
|
|
419
|
+
* The options for formatting an emoji.
|
|
420
|
+
*
|
|
421
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
422
|
+
* @typeParam EmojiName - This is inferred by the supplied emoji name
|
|
423
|
+
*/
|
|
424
|
+
interface FormatEmojiOptions<EmojiId extends Snowflake, EmojiName extends string> {
|
|
425
|
+
/**
|
|
426
|
+
* Whether the emoji is animated
|
|
427
|
+
*/
|
|
428
|
+
animated?: boolean;
|
|
429
|
+
/**
|
|
430
|
+
* The emoji id to format
|
|
431
|
+
*/
|
|
432
|
+
id: EmojiId;
|
|
433
|
+
/**
|
|
434
|
+
* The name of the emoji
|
|
435
|
+
*/
|
|
436
|
+
name?: EmojiName;
|
|
437
|
+
}
|
|
375
438
|
/**
|
|
376
439
|
* Formats a channel link for a direct message channel.
|
|
377
440
|
*
|
|
378
|
-
* @typeParam
|
|
441
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
379
442
|
* @param channelId - The channel's id
|
|
380
443
|
*/
|
|
381
|
-
declare function channelLink<
|
|
444
|
+
declare function channelLink<ChannelId extends Snowflake>(channelId: ChannelId): `https://discord.com/channels/@me/${ChannelId}`;
|
|
382
445
|
/**
|
|
383
446
|
* Formats a channel link for a guild channel.
|
|
384
447
|
*
|
|
385
|
-
* @typeParam
|
|
386
|
-
* @typeParam
|
|
448
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
449
|
+
* @typeParam GuildId - This is inferred by the supplied guild id
|
|
387
450
|
* @param channelId - The channel's id
|
|
388
451
|
* @param guildId - The guild's id
|
|
389
452
|
*/
|
|
390
|
-
declare function channelLink<
|
|
453
|
+
declare function channelLink<ChannelId extends Snowflake, GuildId extends Snowflake>(channelId: ChannelId, guildId: GuildId): `https://discord.com/channels/${GuildId}/${ChannelId}`;
|
|
391
454
|
/**
|
|
392
455
|
* Formats a message link for a direct message channel.
|
|
393
456
|
*
|
|
394
|
-
* @typeParam
|
|
395
|
-
* @typeParam
|
|
457
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
458
|
+
* @typeParam MessageId - This is inferred by the supplied message id
|
|
396
459
|
* @param channelId - The channel's id
|
|
397
460
|
* @param messageId - The message's id
|
|
398
461
|
*/
|
|
399
|
-
declare function messageLink<
|
|
462
|
+
declare function messageLink<ChannelId extends Snowflake, MessageId extends Snowflake>(channelId: ChannelId, messageId: MessageId): `https://discord.com/channels/@me/${ChannelId}/${MessageId}`;
|
|
400
463
|
/**
|
|
401
464
|
* Formats a message link for a guild channel.
|
|
402
465
|
*
|
|
403
|
-
* @typeParam
|
|
404
|
-
* @typeParam
|
|
405
|
-
* @typeParam
|
|
466
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
467
|
+
* @typeParam MessageId - This is inferred by the supplied message id
|
|
468
|
+
* @typeParam GuildId - This is inferred by the supplied guild id
|
|
406
469
|
* @param channelId - The channel's id
|
|
407
470
|
* @param messageId - The message's id
|
|
408
471
|
* @param guildId - The guild's id
|
|
409
472
|
*/
|
|
410
|
-
declare function messageLink<
|
|
473
|
+
declare function messageLink<ChannelId extends Snowflake, MessageId extends Snowflake, GuildId extends Snowflake>(channelId: ChannelId, messageId: MessageId, guildId: GuildId): `https://discord.com/channels/${GuildId}/${ChannelId}/${MessageId}`;
|
|
474
|
+
/**
|
|
475
|
+
* The heading levels for expanded markdown.
|
|
476
|
+
*/
|
|
477
|
+
declare enum HeadingLevel {
|
|
478
|
+
/**
|
|
479
|
+
* The first heading level.
|
|
480
|
+
*/
|
|
481
|
+
One = 1,
|
|
482
|
+
/**
|
|
483
|
+
* The second heading level.
|
|
484
|
+
*/
|
|
485
|
+
Two = 2,
|
|
486
|
+
/**
|
|
487
|
+
* The third heading level.
|
|
488
|
+
*/
|
|
489
|
+
Three = 3
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Formats the content into a heading level.
|
|
493
|
+
*
|
|
494
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
495
|
+
* @param content - The content to wrap
|
|
496
|
+
* @param level - The heading level
|
|
497
|
+
*/
|
|
498
|
+
declare function heading<Content extends string>(content: Content, level?: HeadingLevel.One): `# ${Content}`;
|
|
499
|
+
/**
|
|
500
|
+
* Formats the content into a heading level.
|
|
501
|
+
*
|
|
502
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
503
|
+
* @param content - The content to wrap
|
|
504
|
+
* @param level - The heading level
|
|
505
|
+
*/
|
|
506
|
+
declare function heading<Content extends string>(content: Content, level: HeadingLevel.Two): `## ${Content}`;
|
|
507
|
+
/**
|
|
508
|
+
* Formats the content into a heading level.
|
|
509
|
+
*
|
|
510
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
511
|
+
* @param content - The content to wrap
|
|
512
|
+
* @param level - The heading level
|
|
513
|
+
*/
|
|
514
|
+
declare function heading<Content extends string>(content: Content, level: HeadingLevel.Three): `### ${Content}`;
|
|
515
|
+
/**
|
|
516
|
+
* A type that recursively traverses into arrays.
|
|
517
|
+
*/
|
|
518
|
+
type RecursiveArray<ItemType> = readonly (ItemType | RecursiveArray<ItemType>)[];
|
|
519
|
+
/**
|
|
520
|
+
* Formats the elements in the array to an ordered list.
|
|
521
|
+
*
|
|
522
|
+
* @param list - The array of elements to list
|
|
523
|
+
* @param startNumber - The starting number for the list
|
|
524
|
+
*/
|
|
525
|
+
declare function orderedList(list: RecursiveArray<string>, startNumber?: number): string;
|
|
526
|
+
/**
|
|
527
|
+
* Formats the elements in the array to an unordered list.
|
|
528
|
+
*
|
|
529
|
+
* @param list - The array of elements to list
|
|
530
|
+
*/
|
|
531
|
+
declare function unorderedList(list: RecursiveArray<string>): string;
|
|
532
|
+
/**
|
|
533
|
+
* Formats the content into a subtext.
|
|
534
|
+
*
|
|
535
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
536
|
+
* @param content - The content to wrap
|
|
537
|
+
*/
|
|
538
|
+
declare function subtext<Content extends string>(content: Content): `-# ${Content}`;
|
|
411
539
|
/**
|
|
412
540
|
* Formats a date into a short date-time string.
|
|
413
541
|
*
|
|
@@ -417,27 +545,43 @@ declare function time(date?: Date): `<t:${bigint}>`;
|
|
|
417
545
|
/**
|
|
418
546
|
* Formats a date given a format style.
|
|
419
547
|
*
|
|
420
|
-
* @typeParam
|
|
548
|
+
* @typeParam Style - This is inferred by the supplied {@link TimestampStylesString}
|
|
421
549
|
* @param date - The date to format
|
|
422
550
|
* @param style - The style to use
|
|
423
551
|
*/
|
|
424
|
-
declare function time<
|
|
552
|
+
declare function time<Style extends TimestampStylesString>(date: Date, style: Style): `<t:${bigint}:${Style}>`;
|
|
425
553
|
/**
|
|
426
554
|
* Formats the given timestamp into a short date-time string.
|
|
427
555
|
*
|
|
428
|
-
* @typeParam
|
|
556
|
+
* @typeParam Seconds - This is inferred by the supplied timestamp
|
|
429
557
|
* @param seconds - A Unix timestamp in seconds
|
|
430
558
|
*/
|
|
431
|
-
declare function time<
|
|
559
|
+
declare function time<Seconds extends number>(seconds: Seconds): `<t:${Seconds}>`;
|
|
432
560
|
/**
|
|
433
561
|
* Formats the given timestamp into a short date-time string.
|
|
434
562
|
*
|
|
435
|
-
* @typeParam
|
|
436
|
-
* @typeParam
|
|
563
|
+
* @typeParam Seconds - This is inferred by the supplied timestamp
|
|
564
|
+
* @typeParam Style - This is inferred by the supplied {@link TimestampStylesString}
|
|
437
565
|
* @param seconds - A Unix timestamp in seconds
|
|
438
566
|
* @param style - The style to use
|
|
439
567
|
*/
|
|
440
|
-
declare function time<
|
|
568
|
+
declare function time<Seconds extends number, Style extends TimestampStylesString>(seconds: Seconds, style: Style): `<t:${Seconds}:${Style}>`;
|
|
569
|
+
/**
|
|
570
|
+
* Formats an application directory link.
|
|
571
|
+
*
|
|
572
|
+
* @typeParam ApplicationId - This is inferred by the supplied application id
|
|
573
|
+
* @param applicationId - The application id
|
|
574
|
+
*/
|
|
575
|
+
declare function applicationDirectory<ApplicationId extends Snowflake>(applicationId: ApplicationId): `https://discord.com/application-directory/${ApplicationId}/store`;
|
|
576
|
+
/**
|
|
577
|
+
* Formats an application directory SKU link.
|
|
578
|
+
*
|
|
579
|
+
* @typeParam ApplicationId - This is inferred by the supplied application id
|
|
580
|
+
* @typeParam SKUId - This is inferred by the supplied SKU id
|
|
581
|
+
* @param applicationId - The application id
|
|
582
|
+
* @param skuId - The SKU id
|
|
583
|
+
*/
|
|
584
|
+
declare function applicationDirectory<ApplicationId extends Snowflake, SKUId extends Snowflake>(applicationId: ApplicationId, skuId: SKUId): `https://discord.com/application-directory/${ApplicationId}/store/${SKUId}`;
|
|
441
585
|
/**
|
|
442
586
|
* The {@link https://discord.com/developers/docs/reference#message-formatting-timestamp-styles | message formatting timestamp styles}
|
|
443
587
|
* supported by Discord.
|
|
@@ -497,7 +641,7 @@ declare enum Faces {
|
|
|
497
641
|
/**
|
|
498
642
|
* `¯\_(ツ)_/¯`
|
|
499
643
|
*/
|
|
500
|
-
Shrug = "\
|
|
644
|
+
Shrug = "\u00AF\\_(\u30C4)_/\u00AF",
|
|
501
645
|
/**
|
|
502
646
|
* `(╯°□°)╯︵ ┻━┻`
|
|
503
647
|
*/
|
|
@@ -507,5 +651,34 @@ declare enum Faces {
|
|
|
507
651
|
*/
|
|
508
652
|
Unflip = "\u252C\u2500\u252C\u30CE( \u00BA _ \u00BA\u30CE)"
|
|
509
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* All the available guild navigation mentions.
|
|
656
|
+
*/
|
|
657
|
+
declare enum GuildNavigationMentions {
|
|
658
|
+
/**
|
|
659
|
+
* Browse Channels tab.
|
|
660
|
+
*/
|
|
661
|
+
Browse = "<id:browse>",
|
|
662
|
+
/**
|
|
663
|
+
* Customize tab with the server's {@link https://discord.com/developers/docs/resources/guild#guild-onboarding-object | onboarding prompts}.
|
|
664
|
+
*/
|
|
665
|
+
Customize = "<id:customize>",
|
|
666
|
+
/**
|
|
667
|
+
* {@link https://support.discord.com/hc/articles/13497665141655 | Server Guide} tab.
|
|
668
|
+
*/
|
|
669
|
+
Guide = "<id:guide>",
|
|
670
|
+
/**
|
|
671
|
+
* {@link https://support.discord.com/hc/articles/10388356626711 | Linked Roles} tab.
|
|
672
|
+
*/
|
|
673
|
+
LinkedRoles = "<id:linked-roles>"
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* The {@link https://github.com/discordjs/discord.js/blob/main/packages/formatters#readme | @discordjs/formatters} version
|
|
678
|
+
* that you are currently using.
|
|
679
|
+
*
|
|
680
|
+
* @privateRemarks This needs to explicitly be `string` so it is not typed as a "const string" that gets injected by esbuild.
|
|
681
|
+
*/
|
|
682
|
+
declare const version: string;
|
|
510
683
|
|
|
511
|
-
export { EscapeMarkdownOptions, Faces, TimestampStyles, TimestampStylesString, blockQuote, bold, channelLink, channelMention, chatInputApplicationCommandMention, codeBlock, escapeBold, escapeBulletedList, escapeCodeBlock, escapeEscape, escapeHeading, escapeInlineCode, escapeItalic, escapeMarkdown, escapeMaskedLink, escapeNumberedList, escapeSpoiler, escapeStrikethrough, escapeUnderline, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, italic, messageLink, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
|
|
684
|
+
export { type EscapeMarkdownOptions, Faces, type FormatEmojiOptions, GuildNavigationMentions, HeadingLevel, type RecursiveArray, TimestampStyles, type TimestampStylesString, applicationDirectory, blockQuote, bold, channelLink, channelMention, chatInputApplicationCommandMention, codeBlock, escapeBold, escapeBulletedList, escapeCodeBlock, escapeEscape, escapeHeading, escapeInlineCode, escapeItalic, escapeMarkdown, escapeMaskedLink, escapeNumberedList, escapeSpoiler, escapeStrikethrough, escapeUnderline, formatEmoji, heading, hideLinkEmbed, hyperlink, inlineCode, italic, linkedRoleMention, messageLink, orderedList, quote, roleMention, spoiler, strikethrough, subtext, time, underline, underscore, unorderedList, userMention, version };
|