@discordjs/formatters 0.4.0-dev.1699704227-5b0aa92c8 → 0.4.0-dev.1709467477-9fa115df8
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/dist/index.d.mts +151 -87
- package/dist/index.d.ts +151 -87
- package/dist/index.js +28 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -13
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,209 @@ 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}>`;
|
|
319
327
|
/**
|
|
320
328
|
* Formats an application command name, subcommand group name, subcommand name, and id into an application command mention.
|
|
321
329
|
*
|
|
322
|
-
* @typeParam
|
|
323
|
-
* @typeParam
|
|
324
|
-
* @typeParam
|
|
325
|
-
* @typeParam
|
|
330
|
+
* @typeParam CommandName - This is inferred by the supplied command name
|
|
331
|
+
* @typeParam SubcommandGroupName - This is inferred by the supplied subcommand group name
|
|
332
|
+
* @typeParam SubcommandName - This is inferred by the supplied subcommand name
|
|
333
|
+
* @typeParam CommandId - This is inferred by the supplied command id
|
|
326
334
|
* @param commandName - The application command name to format
|
|
327
335
|
* @param subcommandGroupName - The subcommand group name to format
|
|
328
336
|
* @param subcommandName - The subcommand name to format
|
|
329
337
|
* @param commandId - The application command id to format
|
|
330
338
|
*/
|
|
331
|
-
declare function chatInputApplicationCommandMention<
|
|
339
|
+
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
340
|
/**
|
|
333
341
|
* Formats an application command name, subcommand name, and id into an application command mention.
|
|
334
342
|
*
|
|
335
|
-
* @typeParam
|
|
336
|
-
* @typeParam
|
|
337
|
-
* @typeParam
|
|
343
|
+
* @typeParam CommandName - This is inferred by the supplied command name
|
|
344
|
+
* @typeParam SubcommandName - This is inferred by the supplied subcommand name
|
|
345
|
+
* @typeParam CommandId - This is inferred by the supplied command id
|
|
338
346
|
* @param commandName - The application command name to format
|
|
339
347
|
* @param subcommandName - The subcommand name to format
|
|
340
348
|
* @param commandId - The application command id to format
|
|
341
349
|
*/
|
|
342
|
-
declare function chatInputApplicationCommandMention<
|
|
350
|
+
declare function chatInputApplicationCommandMention<CommandName extends string, SubcommandName extends string, CommandId extends Snowflake>(commandName: CommandName, subcommandName: SubcommandName, commandId: CommandId): `</${CommandName} ${SubcommandName}:${CommandId}>`;
|
|
343
351
|
/**
|
|
344
352
|
* Formats an application command name and id into an application command mention.
|
|
345
353
|
*
|
|
346
|
-
* @typeParam
|
|
347
|
-
* @typeParam
|
|
354
|
+
* @typeParam CommandName - This is inferred by the supplied command name
|
|
355
|
+
* @typeParam CommandId - This is inferred by the supplied command id
|
|
348
356
|
* @param commandName - The application command name to format
|
|
349
357
|
* @param commandId - The application command id to format
|
|
350
358
|
*/
|
|
351
|
-
declare function chatInputApplicationCommandMention<
|
|
359
|
+
declare function chatInputApplicationCommandMention<CommandName extends string, CommandId extends Snowflake>(commandName: CommandName, commandId: CommandId): `</${CommandName}:${CommandId}>`;
|
|
352
360
|
/**
|
|
353
361
|
* Formats a non-animated emoji id into a fully qualified emoji identifier.
|
|
354
362
|
*
|
|
355
|
-
* @typeParam
|
|
363
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
356
364
|
* @param emojiId - The emoji id to format
|
|
357
365
|
*/
|
|
358
|
-
declare function formatEmoji<
|
|
366
|
+
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: false): `<:_:${EmojiId}>`;
|
|
359
367
|
/**
|
|
360
368
|
* Formats an animated emoji id into a fully qualified emoji identifier.
|
|
361
369
|
*
|
|
362
|
-
* @typeParam
|
|
370
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
363
371
|
* @param emojiId - The emoji id to format
|
|
364
372
|
* @param animated - Whether the emoji is animated
|
|
365
373
|
*/
|
|
366
|
-
declare function formatEmoji<
|
|
374
|
+
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: true): `<a:_:${EmojiId}>`;
|
|
367
375
|
/**
|
|
368
376
|
* Formats an emoji id into a fully qualified emoji identifier.
|
|
369
377
|
*
|
|
370
|
-
* @typeParam
|
|
378
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
371
379
|
* @param emojiId - The emoji id to format
|
|
372
380
|
* @param animated - Whether the emoji is animated
|
|
373
381
|
*/
|
|
374
|
-
declare function formatEmoji<
|
|
382
|
+
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: boolean): `<:_:${EmojiId}>` | `<a:_:${EmojiId}>`;
|
|
383
|
+
/**
|
|
384
|
+
* Formats a non-animated emoji id and name into a fully qualified emoji identifier.
|
|
385
|
+
*
|
|
386
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
387
|
+
* @typeParam EmojiName - This is inferred by the supplied name
|
|
388
|
+
* @param options - The options for formatting an emoji
|
|
389
|
+
*/
|
|
390
|
+
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName> & {
|
|
391
|
+
animated: true;
|
|
392
|
+
}): `<a:${EmojiName}:${EmojiId}>`;
|
|
393
|
+
/**
|
|
394
|
+
* Formats an animated emoji id and name into a fully qualified emoji identifier.
|
|
395
|
+
*
|
|
396
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
397
|
+
* @typeParam EmojiName - This is inferred by the supplied name
|
|
398
|
+
* @param options - The options for formatting an emoji
|
|
399
|
+
*/
|
|
400
|
+
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName> & {
|
|
401
|
+
animated?: false;
|
|
402
|
+
}): `<:${EmojiName}:${EmojiId}>`;
|
|
403
|
+
/**
|
|
404
|
+
* Formats an emoji id and name into a fully qualified emoji identifier.
|
|
405
|
+
*
|
|
406
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
407
|
+
* @typeParam EmojiName - This is inferred by the supplied emoji name
|
|
408
|
+
* @param options - The options for formatting an emoji
|
|
409
|
+
*/
|
|
410
|
+
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName>): `<:${EmojiName}:${EmojiId}>` | `<a:${EmojiName}:${EmojiId}>`;
|
|
411
|
+
/**
|
|
412
|
+
* The options for formatting an emoji.
|
|
413
|
+
*
|
|
414
|
+
* @typeParam EmojiId - This is inferred by the supplied emoji id
|
|
415
|
+
* @typeParam EmojiName - This is inferred by the supplied emoji name
|
|
416
|
+
*/
|
|
417
|
+
interface FormatEmojiOptions<EmojiId extends Snowflake, EmojiName extends string> {
|
|
418
|
+
/**
|
|
419
|
+
* Whether the emoji is animated
|
|
420
|
+
*/
|
|
421
|
+
animated?: boolean;
|
|
422
|
+
/**
|
|
423
|
+
* The emoji id to format
|
|
424
|
+
*/
|
|
425
|
+
id: EmojiId;
|
|
426
|
+
/**
|
|
427
|
+
* The name of the emoji
|
|
428
|
+
*/
|
|
429
|
+
name?: EmojiName;
|
|
430
|
+
}
|
|
375
431
|
/**
|
|
376
432
|
* Formats a channel link for a direct message channel.
|
|
377
433
|
*
|
|
378
|
-
* @typeParam
|
|
434
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
379
435
|
* @param channelId - The channel's id
|
|
380
436
|
*/
|
|
381
|
-
declare function channelLink<
|
|
437
|
+
declare function channelLink<ChannelId extends Snowflake>(channelId: ChannelId): `https://discord.com/channels/@me/${ChannelId}`;
|
|
382
438
|
/**
|
|
383
439
|
* Formats a channel link for a guild channel.
|
|
384
440
|
*
|
|
385
|
-
* @typeParam
|
|
386
|
-
* @typeParam
|
|
441
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
442
|
+
* @typeParam GuildId - This is inferred by the supplied guild id
|
|
387
443
|
* @param channelId - The channel's id
|
|
388
444
|
* @param guildId - The guild's id
|
|
389
445
|
*/
|
|
390
|
-
declare function channelLink<
|
|
446
|
+
declare function channelLink<ChannelId extends Snowflake, GuildId extends Snowflake>(channelId: ChannelId, guildId: GuildId): `https://discord.com/channels/${GuildId}/${ChannelId}`;
|
|
391
447
|
/**
|
|
392
448
|
* Formats a message link for a direct message channel.
|
|
393
449
|
*
|
|
394
|
-
* @typeParam
|
|
395
|
-
* @typeParam
|
|
450
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
451
|
+
* @typeParam MessageId - This is inferred by the supplied message id
|
|
396
452
|
* @param channelId - The channel's id
|
|
397
453
|
* @param messageId - The message's id
|
|
398
454
|
*/
|
|
399
|
-
declare function messageLink<
|
|
455
|
+
declare function messageLink<ChannelId extends Snowflake, MessageId extends Snowflake>(channelId: ChannelId, messageId: MessageId): `https://discord.com/channels/@me/${ChannelId}/${MessageId}`;
|
|
400
456
|
/**
|
|
401
457
|
* Formats a message link for a guild channel.
|
|
402
458
|
*
|
|
403
|
-
* @typeParam
|
|
404
|
-
* @typeParam
|
|
405
|
-
* @typeParam
|
|
459
|
+
* @typeParam ChannelId - This is inferred by the supplied channel id
|
|
460
|
+
* @typeParam MessageId - This is inferred by the supplied message id
|
|
461
|
+
* @typeParam GuildId - This is inferred by the supplied guild id
|
|
406
462
|
* @param channelId - The channel's id
|
|
407
463
|
* @param messageId - The message's id
|
|
408
464
|
* @param guildId - The guild's id
|
|
409
465
|
*/
|
|
410
|
-
declare function messageLink<
|
|
466
|
+
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}`;
|
|
411
467
|
/**
|
|
412
468
|
* The heading levels for expanded markdown.
|
|
413
469
|
*/
|
|
@@ -428,31 +484,31 @@ declare enum HeadingLevel {
|
|
|
428
484
|
/**
|
|
429
485
|
* Formats the content into a heading level.
|
|
430
486
|
*
|
|
431
|
-
* @typeParam
|
|
487
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
432
488
|
* @param content - The content to wrap
|
|
433
489
|
* @param level - The heading level
|
|
434
490
|
*/
|
|
435
|
-
declare function heading<
|
|
491
|
+
declare function heading<Content extends string>(content: Content, level?: HeadingLevel.One): `# ${Content}`;
|
|
436
492
|
/**
|
|
437
493
|
* Formats the content into a heading level.
|
|
438
494
|
*
|
|
439
|
-
* @typeParam
|
|
495
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
440
496
|
* @param content - The content to wrap
|
|
441
497
|
* @param level - The heading level
|
|
442
498
|
*/
|
|
443
|
-
declare function heading<
|
|
499
|
+
declare function heading<Content extends string>(content: Content, level: HeadingLevel.Two): `## ${Content}`;
|
|
444
500
|
/**
|
|
445
501
|
* Formats the content into a heading level.
|
|
446
502
|
*
|
|
447
|
-
* @typeParam
|
|
503
|
+
* @typeParam Content - This is inferred by the supplied content
|
|
448
504
|
* @param content - The content to wrap
|
|
449
505
|
* @param level - The heading level
|
|
450
506
|
*/
|
|
451
|
-
declare function heading<
|
|
507
|
+
declare function heading<Content extends string>(content: Content, level: HeadingLevel.Three): `### ${Content}`;
|
|
452
508
|
/**
|
|
453
509
|
* A type that recursively traverses into arrays.
|
|
454
510
|
*/
|
|
455
|
-
type RecursiveArray<
|
|
511
|
+
type RecursiveArray<ItemType> = readonly (ItemType | RecursiveArray<ItemType>)[];
|
|
456
512
|
/**
|
|
457
513
|
* Formats the elements in the array to an ordered list.
|
|
458
514
|
*
|
|
@@ -475,27 +531,27 @@ declare function time(date?: Date): `<t:${bigint}>`;
|
|
|
475
531
|
/**
|
|
476
532
|
* Formats a date given a format style.
|
|
477
533
|
*
|
|
478
|
-
* @typeParam
|
|
534
|
+
* @typeParam Style - This is inferred by the supplied {@link TimestampStylesString}
|
|
479
535
|
* @param date - The date to format
|
|
480
536
|
* @param style - The style to use
|
|
481
537
|
*/
|
|
482
|
-
declare function time<
|
|
538
|
+
declare function time<Style extends TimestampStylesString>(date: Date, style: Style): `<t:${bigint}:${Style}>`;
|
|
483
539
|
/**
|
|
484
540
|
* Formats the given timestamp into a short date-time string.
|
|
485
541
|
*
|
|
486
|
-
* @typeParam
|
|
542
|
+
* @typeParam Seconds - This is inferred by the supplied timestamp
|
|
487
543
|
* @param seconds - A Unix timestamp in seconds
|
|
488
544
|
*/
|
|
489
|
-
declare function time<
|
|
545
|
+
declare function time<Seconds extends number>(seconds: Seconds): `<t:${Seconds}>`;
|
|
490
546
|
/**
|
|
491
547
|
* Formats the given timestamp into a short date-time string.
|
|
492
548
|
*
|
|
493
|
-
* @typeParam
|
|
494
|
-
* @typeParam
|
|
549
|
+
* @typeParam Seconds - This is inferred by the supplied timestamp
|
|
550
|
+
* @typeParam Style - This is inferred by the supplied {@link TimestampStylesString}
|
|
495
551
|
* @param seconds - A Unix timestamp in seconds
|
|
496
552
|
* @param style - The style to use
|
|
497
553
|
*/
|
|
498
|
-
declare function time<
|
|
554
|
+
declare function time<Seconds extends number, Style extends TimestampStylesString>(seconds: Seconds, style: Style): `<t:${Seconds}:${Style}>`;
|
|
499
555
|
/**
|
|
500
556
|
* The {@link https://discord.com/developers/docs/reference#message-formatting-timestamp-styles | message formatting timestamp styles}
|
|
501
557
|
* supported by Discord.
|
|
@@ -555,7 +611,7 @@ declare enum Faces {
|
|
|
555
611
|
/**
|
|
556
612
|
* `¯\_(ツ)_/¯`
|
|
557
613
|
*/
|
|
558
|
-
Shrug = "\
|
|
614
|
+
Shrug = "\u00AF\\_(\u30C4)_/\u00AF",
|
|
559
615
|
/**
|
|
560
616
|
* `(╯°□°)╯︵ ┻━┻`
|
|
561
617
|
*/
|
|
@@ -583,4 +639,12 @@ declare enum GuildNavigationMentions {
|
|
|
583
639
|
Guide = "<id:guide>"
|
|
584
640
|
}
|
|
585
641
|
|
|
586
|
-
|
|
642
|
+
/**
|
|
643
|
+
* The {@link https://github.com/discordjs/discord.js/blob/main/packages/formatters#readme | @discordjs/formatters} version
|
|
644
|
+
* that you are currently using.
|
|
645
|
+
*
|
|
646
|
+
* @privateRemarks This needs to explicitly be `string` so it is not typed as a "const string" that gets injected by esbuild.
|
|
647
|
+
*/
|
|
648
|
+
declare const version: string;
|
|
649
|
+
|
|
650
|
+
export { type EscapeMarkdownOptions, Faces, type FormatEmojiOptions, GuildNavigationMentions, HeadingLevel, type RecursiveArray, TimestampStyles, type TimestampStylesString, 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, messageLink, orderedList, quote, roleMention, spoiler, strikethrough, time, underline, underscore, unorderedList, userMention, version };
|