feat: init

This commit is contained in:
Nick 2024-08-10 02:59:22 -05:00
parent 8379d09058
commit 2cfa016090
2929 changed files with 299087 additions and 3 deletions

191
node_modules/@discordjs/formatters/LICENSE generated vendored Normal file
View file

@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2021 Noel Buechler
Copyright 2021 Vlad Frangu
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

82
node_modules/@discordjs/formatters/README.md generated vendored Normal file
View file

@ -0,0 +1,82 @@
<div align="center">
<br />
<p>
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
</p>
<br />
<p>
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
<a href="https://www.npmjs.com/package/@discordjs/formatters"><img src="https://img.shields.io/npm/v/@discordjs/formatters.svg?maxAge=3600" alt="npm version" /></a>
<a href="https://www.npmjs.com/package/@discordjs/formatters"><img src="https://img.shields.io/npm/dt/@discordjs/formatters.svg?maxAge=3600" alt="npm downloads" /></a>
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
<a href="https://codecov.io/gh/discordjs/discord.js" ><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2&flag=formatters" alt="Code coverage" /></a>
</p>
<p>
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
<a href="https://www.cloudflare.com"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-workers.png" alt="Cloudflare Workers" height="44" /></a>
</p>
</div>
## About
`@discordjs/formatters` is a collection of functions for formatting strings to be used on Discord.
## Installation
**Node.js 16.11.0 or newer is required.**
```sh
npm install @discordjs/formatters
yarn add @discordjs/formatters
pnpm add @discordjs/formatters
bun add @discordjs/formatters
```
## Example usage
````ts
import { codeBlock } from '@discordjs/formatters';
const formattedCode = codeBlock('hello world!');
console.log(formattedCode);
// Prints:
// ```
// hello world!
// ```
````
## Links
- [Website][website] ([source][website-source])
- [Documentation][documentation]
- [Guide][guide] ([source][guide-source])
Also see the v13 to v14 [Update Guide][guide-update], which includes updated and removed items from the library.
- [discord.js Discord server][discord]
- [Discord API Discord server][discord-api]
- [GitHub][source]
- [npm][npm]
- [Related libraries][related-libs]
## Contributing
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
[documentation][documentation].
See [the contribution guide][contributing] if you'd like to submit a PR.
## Help
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official [discord.js Server][discord].
[website]: https://discord.js.org
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
[documentation]: https://discord.js.org/docs/packages/formatters/stable
[guide]: https://discordjs.guide/
[guide-source]: https://github.com/discordjs/guide
[guide-update]: https://discordjs.guide/additional-info/changes-in-v14.html
[discord]: https://discord.gg/djs
[discord-api]: https://discord.gg/discord-api
[source]: https://github.com/discordjs/discord.js/tree/main/packages/formatters
[npm]: https://www.npmjs.com/package/@discordjs/formatters
[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries
[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md

650
node_modules/@discordjs/formatters/dist/index.d.mts generated vendored Normal file
View file

@ -0,0 +1,650 @@
import { URL } from 'node:url';
import { Snowflake } from 'discord-api-types/globals';
/**
* The options that affect what will be escaped.
*/
interface EscapeMarkdownOptions {
/**
* Whether to escape bold text.
*
* @defaultValue `true`
*/
bold?: boolean;
/**
* Whether to escape bulleted lists.
*
* @defaultValue `false`
*/
bulletedList?: boolean;
/**
* Whether to escape code blocks.
*
* @defaultValue `true`
*/
codeBlock?: boolean;
/**
* Whether to escape text inside code blocks.
*
* @defaultValue `true`
*/
codeBlockContent?: boolean;
/**
* Whether to escape `\`.
*
* @defaultValue `true`
*/
escape?: boolean;
/**
* Whether to escape headings.
*
* @defaultValue `false`
*/
heading?: boolean;
/**
* Whether to escape inline code.
*
* @defaultValue `true`
*/
inlineCode?: boolean;
/**
* Whether to escape text inside inline code.
*
* @defaultValue `true`
*/
inlineCodeContent?: boolean;
/**
* Whether to escape italics.
*
* @defaultValue `true`
*/
italic?: boolean;
/**
* Whether to escape masked links.
*
* @defaultValue `false`
*/
maskedLink?: boolean;
/**
* Whether to escape numbered lists.
*
* @defaultValue `false`
*/
numberedList?: boolean;
/**
* Whether to escape spoilers.
*
* @defaultValue `true`
*/
spoiler?: boolean;
/**
* Whether to escape strikethroughs.
*
* @defaultValue `true`
*/
strikethrough?: boolean;
/**
* Whether to escape underlines.
*
* @defaultValue `true`
*/
underline?: boolean;
}
/**
* Escapes any Discord-flavored markdown in a string.
*
* @param text - Content to escape
* @param options - Options for escaping the markdown
*/
declare function escapeMarkdown(text: string, options?: EscapeMarkdownOptions): string;
/**
* Escapes code block markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeCodeBlock(text: string): string;
/**
* Escapes inline code markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeInlineCode(text: string): string;
/**
* Escapes italic markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeItalic(text: string): string;
/**
* Escapes bold markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeBold(text: string): string;
/**
* Escapes underline markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeUnderline(text: string): string;
/**
* Escapes strikethrough markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeStrikethrough(text: string): string;
/**
* Escapes spoiler markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeSpoiler(text: string): string;
/**
* Escapes escape characters in a string.
*
* @param text - Content to escape
*/
declare function escapeEscape(text: string): string;
/**
* Escapes heading characters in a string.
*
* @param text - Content to escape
*/
declare function escapeHeading(text: string): string;
/**
* Escapes bulleted list characters in a string.
*
* @param text - Content to escape
*/
declare function escapeBulletedList(text: string): string;
/**
* Escapes numbered list characters in a string.
*
* @param text - Content to escape
*/
declare function escapeNumberedList(text: string): string;
/**
* Escapes masked link characters in a string.
*
* @param text - Content to escape
*/
declare function escapeMaskedLink(text: string): string;
/**
* Wraps the content inside a code block with no language.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function codeBlock<Content extends string>(content: Content): `\`\`\`\n${Content}\n\`\`\``;
/**
* Wraps the content inside a code block with the specified language.
*
* @typeParam Language - This is inferred by the supplied language
* @typeParam Content - This is inferred by the supplied content
* @param language - The language for the code block
* @param content - The content to wrap
*/
declare function codeBlock<Language extends string, Content extends string>(language: Language, content: Content): `\`\`\`${Language}\n${Content}\n\`\`\``;
/**
* Wraps the content inside \`backticks\` which formats it as inline code.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function inlineCode<Content extends string>(content: Content): `\`${Content}\``;
/**
* Formats the content into italic text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function italic<Content extends string>(content: Content): `_${Content}_`;
/**
* Formats the content into bold text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function bold<Content extends string>(content: Content): `**${Content}**`;
/**
* Formats the content into underscored text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
* @deprecated Use {@link underline} instead.
*/
declare function underscore<Content extends string>(content: Content): `__${Content}__`;
/**
* Formats the content into underlined text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function underline<Content extends string>(content: Content): `__${Content}__`;
/**
* Formats the content into strike-through text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function strikethrough<Content extends string>(content: Content): `~~${Content}~~`;
/**
* Formats the content into a quote.
*
* @remarks This needs to be at the start of the line for Discord to format it.
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function quote<Content extends string>(content: Content): `> ${Content}`;
/**
* Formats the content into a block quote.
*
* @remarks This needs to be at the start of the line for Discord to format it.
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function blockQuote<Content extends string>(content: Content): `>>> ${Content}`;
/**
* Wraps the URL into `<>` which stops it from embedding.
*
* @typeParam Content - This is inferred by the supplied content
* @param url - The URL to wrap
*/
declare function hideLinkEmbed<Content extends string>(url: Content): `<${Content}>`;
/**
* Wraps the URL into `<>` which stops it from embedding.
*
* @param url - The URL to wrap
*/
declare function hideLinkEmbed(url: URL): `<${string}>`;
/**
* Formats the content and the URL into a masked URL.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to display
* @param url - The URL the content links to
*/
declare function hyperlink<Content extends string>(content: Content, url: URL): `[${Content}](${string})`;
/**
* Formats the content and the URL into a masked URL.
*
* @typeParam Content - This is inferred by the supplied content
* @typeParam Url - This is inferred by the supplied URL
* @param content - The content to display
* @param url - The URL the content links to
*/
declare function hyperlink<Content extends string, Url extends string>(content: Content, url: Url): `[${Content}](${Url})`;
/**
* Formats the content and the URL into a masked URL with a custom tooltip.
*
* @typeParam Content - This is inferred by the supplied content
* @typeParam Title - This is inferred by the supplied title
* @param content - The content to display
* @param url - The URL the content links to
* @param title - The title shown when hovering on the masked link
*/
declare function hyperlink<Content extends string, Title extends string>(content: Content, url: URL, title: Title): `[${Content}](${string} "${Title}")`;
/**
* Formats the content and the URL into a masked URL with a custom tooltip.
*
* @typeParam Content - This is inferred by the supplied content
* @typeParam Url - This is inferred by the supplied URL
* @typeParam Title - This is inferred by the supplied title
* @param content - The content to display
* @param url - The URL the content links to
* @param title - The title shown when hovering on the masked link
*/
declare function hyperlink<Content extends string, Url extends string, Title extends string>(content: Content, url: Url, title: Title): `[${Content}](${Url} "${Title}")`;
/**
* Formats the content into a spoiler.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function spoiler<Content extends string>(content: Content): `||${Content}||`;
/**
* Formats a user id into a user mention.
*
* @typeParam UserId - This is inferred by the supplied user id
* @param userId - The user id to format
*/
declare function userMention<UserId extends Snowflake>(userId: UserId): `<@${UserId}>`;
/**
* Formats a channel id into a channel mention.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @param channelId - The channel id to format
*/
declare function channelMention<ChannelId extends Snowflake>(channelId: ChannelId): `<#${ChannelId}>`;
/**
* Formats a role id into a role mention.
*
* @typeParam RoleId - This is inferred by the supplied role id
* @param roleId - The role id to format
*/
declare function roleMention<RoleId extends Snowflake>(roleId: RoleId): `<@&${RoleId}>`;
/**
* Formats an application command name, subcommand group name, subcommand name, and id into an application command mention.
*
* @typeParam CommandName - This is inferred by the supplied command name
* @typeParam SubcommandGroupName - This is inferred by the supplied subcommand group name
* @typeParam SubcommandName - This is inferred by the supplied subcommand name
* @typeParam CommandId - This is inferred by the supplied command id
* @param commandName - The application command name to format
* @param subcommandGroupName - The subcommand group name to format
* @param subcommandName - The subcommand name to format
* @param commandId - The application command id to format
*/
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}>`;
/**
* Formats an application command name, subcommand name, and id into an application command mention.
*
* @typeParam CommandName - This is inferred by the supplied command name
* @typeParam SubcommandName - This is inferred by the supplied subcommand name
* @typeParam CommandId - This is inferred by the supplied command id
* @param commandName - The application command name to format
* @param subcommandName - The subcommand name to format
* @param commandId - The application command id to format
*/
declare function chatInputApplicationCommandMention<CommandName extends string, SubcommandName extends string, CommandId extends Snowflake>(commandName: CommandName, subcommandName: SubcommandName, commandId: CommandId): `</${CommandName} ${SubcommandName}:${CommandId}>`;
/**
* Formats an application command name and id into an application command mention.
*
* @typeParam CommandName - This is inferred by the supplied command name
* @typeParam CommandId - This is inferred by the supplied command id
* @param commandName - The application command name to format
* @param commandId - The application command id to format
*/
declare function chatInputApplicationCommandMention<CommandName extends string, CommandId extends Snowflake>(commandName: CommandName, commandId: CommandId): `</${CommandName}:${CommandId}>`;
/**
* Formats a non-animated emoji id into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @param emojiId - The emoji id to format
*/
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: false): `<:_:${EmojiId}>`;
/**
* Formats an animated emoji id into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @param emojiId - The emoji id to format
* @param animated - Whether the emoji is animated
*/
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: true): `<a:_:${EmojiId}>`;
/**
* Formats an emoji id into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @param emojiId - The emoji id to format
* @param animated - Whether the emoji is animated
*/
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: boolean): `<:_:${EmojiId}>` | `<a:_:${EmojiId}>`;
/**
* Formats a non-animated emoji id and name into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @typeParam EmojiName - This is inferred by the supplied name
* @param options - The options for formatting an emoji
*/
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName> & {
animated: true;
}): `<a:${EmojiName}:${EmojiId}>`;
/**
* Formats an animated emoji id and name into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @typeParam EmojiName - This is inferred by the supplied name
* @param options - The options for formatting an emoji
*/
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName> & {
animated?: false;
}): `<:${EmojiName}:${EmojiId}>`;
/**
* Formats an emoji id and name into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @typeParam EmojiName - This is inferred by the supplied emoji name
* @param options - The options for formatting an emoji
*/
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName>): `<:${EmojiName}:${EmojiId}>` | `<a:${EmojiName}:${EmojiId}>`;
/**
* The options for formatting an emoji.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @typeParam EmojiName - This is inferred by the supplied emoji name
*/
interface FormatEmojiOptions<EmojiId extends Snowflake, EmojiName extends string> {
/**
* Whether the emoji is animated
*/
animated?: boolean;
/**
* The emoji id to format
*/
id: EmojiId;
/**
* The name of the emoji
*/
name?: EmojiName;
}
/**
* Formats a channel link for a direct message channel.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @param channelId - The channel's id
*/
declare function channelLink<ChannelId extends Snowflake>(channelId: ChannelId): `https://discord.com/channels/@me/${ChannelId}`;
/**
* Formats a channel link for a guild channel.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @typeParam GuildId - This is inferred by the supplied guild id
* @param channelId - The channel's id
* @param guildId - The guild's id
*/
declare function channelLink<ChannelId extends Snowflake, GuildId extends Snowflake>(channelId: ChannelId, guildId: GuildId): `https://discord.com/channels/${GuildId}/${ChannelId}`;
/**
* Formats a message link for a direct message channel.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @typeParam MessageId - This is inferred by the supplied message id
* @param channelId - The channel's id
* @param messageId - The message's id
*/
declare function messageLink<ChannelId extends Snowflake, MessageId extends Snowflake>(channelId: ChannelId, messageId: MessageId): `https://discord.com/channels/@me/${ChannelId}/${MessageId}`;
/**
* Formats a message link for a guild channel.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @typeParam MessageId - This is inferred by the supplied message id
* @typeParam GuildId - This is inferred by the supplied guild id
* @param channelId - The channel's id
* @param messageId - The message's id
* @param guildId - The guild's id
*/
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}`;
/**
* The heading levels for expanded markdown.
*/
declare enum HeadingLevel {
/**
* The first heading level.
*/
One = 1,
/**
* The second heading level.
*/
Two = 2,
/**
* The third heading level.
*/
Three = 3
}
/**
* Formats the content into a heading level.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
* @param level - The heading level
*/
declare function heading<Content extends string>(content: Content, level?: HeadingLevel.One): `# ${Content}`;
/**
* Formats the content into a heading level.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
* @param level - The heading level
*/
declare function heading<Content extends string>(content: Content, level: HeadingLevel.Two): `## ${Content}`;
/**
* Formats the content into a heading level.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
* @param level - The heading level
*/
declare function heading<Content extends string>(content: Content, level: HeadingLevel.Three): `### ${Content}`;
/**
* A type that recursively traverses into arrays.
*/
type RecursiveArray<ItemType> = readonly (ItemType | RecursiveArray<ItemType>)[];
/**
* Formats the elements in the array to an ordered list.
*
* @param list - The array of elements to list
* @param startNumber - The starting number for the list
*/
declare function orderedList(list: RecursiveArray<string>, startNumber?: number): string;
/**
* Formats the elements in the array to an unordered list.
*
* @param list - The array of elements to list
*/
declare function unorderedList(list: RecursiveArray<string>): string;
/**
* Formats a date into a short date-time string.
*
* @param date - The date to format. Defaults to the current time
*/
declare function time(date?: Date): `<t:${bigint}>`;
/**
* Formats a date given a format style.
*
* @typeParam Style - This is inferred by the supplied {@link TimestampStylesString}
* @param date - The date to format
* @param style - The style to use
*/
declare function time<Style extends TimestampStylesString>(date: Date, style: Style): `<t:${bigint}:${Style}>`;
/**
* Formats the given timestamp into a short date-time string.
*
* @typeParam Seconds - This is inferred by the supplied timestamp
* @param seconds - A Unix timestamp in seconds
*/
declare function time<Seconds extends number>(seconds: Seconds): `<t:${Seconds}>`;
/**
* Formats the given timestamp into a short date-time string.
*
* @typeParam Seconds - This is inferred by the supplied timestamp
* @typeParam Style - This is inferred by the supplied {@link TimestampStylesString}
* @param seconds - A Unix timestamp in seconds
* @param style - The style to use
*/
declare function time<Seconds extends number, Style extends TimestampStylesString>(seconds: Seconds, style: Style): `<t:${Seconds}:${Style}>`;
/**
* The {@link https://discord.com/developers/docs/reference#message-formatting-timestamp-styles | message formatting timestamp styles}
* supported by Discord.
*/
declare const TimestampStyles: {
/**
* Short time format, consisting of hours and minutes.
*
* @example `16:20`
*/
readonly ShortTime: "t";
/**
* Long time format, consisting of hours, minutes, and seconds.
*
* @example `16:20:30`
*/
readonly LongTime: "T";
/**
* Short date format, consisting of day, month, and year.
*
* @example `20/04/2021`
*/
readonly ShortDate: "d";
/**
* Long date format, consisting of day, month, and year.
*
* @example `20 April 2021`
*/
readonly LongDate: "D";
/**
* Short date-time format, consisting of short date and short time formats.
*
* @example `20 April 2021 16:20`
*/
readonly ShortDateTime: "f";
/**
* Long date-time format, consisting of long date and short time formats.
*
* @example `Tuesday, 20 April 2021 16:20`
*/
readonly LongDateTime: "F";
/**
* Relative time format, consisting of a relative duration format.
*
* @example `2 months ago`
*/
readonly RelativeTime: "R";
};
/**
* The possible {@link TimestampStyles} values.
*/
type TimestampStylesString = (typeof TimestampStyles)[keyof typeof TimestampStyles];
/**
* All the available faces from Discord's native slash commands.
*/
declare enum Faces {
/**
* `¯\_(ツ)_/¯`
*/
Shrug = "\u00AF\\_(\u30C4)_/\u00AF",
/**
* `(╯°□°)╯︵ ┻━┻`
*/
Tableflip = "(\u256F\u00B0\u25A1\u00B0)\u256F\uFE35 \u253B\u2501\u253B",
/**
* `┬─┬ノ( º _ ºノ)`
*/
Unflip = "\u252C\u2500\u252C\u30CE( \u00BA _ \u00BA\u30CE)"
}
/**
* All the available guild navigation mentions.
*/
declare enum GuildNavigationMentions {
/**
* Browse Channels tab.
*/
Browse = "<id:browse>",
/**
* Customize tab with the server's {@link https://discord.com/developers/docs/resources/guild#guild-onboarding-object | onboarding prompts}.
*/
Customize = "<id:customize>",
/**
* {@link https://support.discord.com/hc/articles/13497665141655 | Server Guide} tab.
*/
Guide = "<id:guide>"
}
/**
* The {@link https://github.com/discordjs/discord.js/blob/main/packages/formatters#readme | @discordjs/formatters} version
* that you are currently using.
*
* @privateRemarks This needs to explicitly be `string` so it is not typed as a "const string" that gets injected by esbuild.
*/
declare const version: string;
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 };

650
node_modules/@discordjs/formatters/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,650 @@
import { URL } from 'node:url';
import { Snowflake } from 'discord-api-types/globals';
/**
* The options that affect what will be escaped.
*/
interface EscapeMarkdownOptions {
/**
* Whether to escape bold text.
*
* @defaultValue `true`
*/
bold?: boolean;
/**
* Whether to escape bulleted lists.
*
* @defaultValue `false`
*/
bulletedList?: boolean;
/**
* Whether to escape code blocks.
*
* @defaultValue `true`
*/
codeBlock?: boolean;
/**
* Whether to escape text inside code blocks.
*
* @defaultValue `true`
*/
codeBlockContent?: boolean;
/**
* Whether to escape `\`.
*
* @defaultValue `true`
*/
escape?: boolean;
/**
* Whether to escape headings.
*
* @defaultValue `false`
*/
heading?: boolean;
/**
* Whether to escape inline code.
*
* @defaultValue `true`
*/
inlineCode?: boolean;
/**
* Whether to escape text inside inline code.
*
* @defaultValue `true`
*/
inlineCodeContent?: boolean;
/**
* Whether to escape italics.
*
* @defaultValue `true`
*/
italic?: boolean;
/**
* Whether to escape masked links.
*
* @defaultValue `false`
*/
maskedLink?: boolean;
/**
* Whether to escape numbered lists.
*
* @defaultValue `false`
*/
numberedList?: boolean;
/**
* Whether to escape spoilers.
*
* @defaultValue `true`
*/
spoiler?: boolean;
/**
* Whether to escape strikethroughs.
*
* @defaultValue `true`
*/
strikethrough?: boolean;
/**
* Whether to escape underlines.
*
* @defaultValue `true`
*/
underline?: boolean;
}
/**
* Escapes any Discord-flavored markdown in a string.
*
* @param text - Content to escape
* @param options - Options for escaping the markdown
*/
declare function escapeMarkdown(text: string, options?: EscapeMarkdownOptions): string;
/**
* Escapes code block markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeCodeBlock(text: string): string;
/**
* Escapes inline code markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeInlineCode(text: string): string;
/**
* Escapes italic markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeItalic(text: string): string;
/**
* Escapes bold markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeBold(text: string): string;
/**
* Escapes underline markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeUnderline(text: string): string;
/**
* Escapes strikethrough markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeStrikethrough(text: string): string;
/**
* Escapes spoiler markdown in a string.
*
* @param text - Content to escape
*/
declare function escapeSpoiler(text: string): string;
/**
* Escapes escape characters in a string.
*
* @param text - Content to escape
*/
declare function escapeEscape(text: string): string;
/**
* Escapes heading characters in a string.
*
* @param text - Content to escape
*/
declare function escapeHeading(text: string): string;
/**
* Escapes bulleted list characters in a string.
*
* @param text - Content to escape
*/
declare function escapeBulletedList(text: string): string;
/**
* Escapes numbered list characters in a string.
*
* @param text - Content to escape
*/
declare function escapeNumberedList(text: string): string;
/**
* Escapes masked link characters in a string.
*
* @param text - Content to escape
*/
declare function escapeMaskedLink(text: string): string;
/**
* Wraps the content inside a code block with no language.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function codeBlock<Content extends string>(content: Content): `\`\`\`\n${Content}\n\`\`\``;
/**
* Wraps the content inside a code block with the specified language.
*
* @typeParam Language - This is inferred by the supplied language
* @typeParam Content - This is inferred by the supplied content
* @param language - The language for the code block
* @param content - The content to wrap
*/
declare function codeBlock<Language extends string, Content extends string>(language: Language, content: Content): `\`\`\`${Language}\n${Content}\n\`\`\``;
/**
* Wraps the content inside \`backticks\` which formats it as inline code.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function inlineCode<Content extends string>(content: Content): `\`${Content}\``;
/**
* Formats the content into italic text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function italic<Content extends string>(content: Content): `_${Content}_`;
/**
* Formats the content into bold text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function bold<Content extends string>(content: Content): `**${Content}**`;
/**
* Formats the content into underscored text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
* @deprecated Use {@link underline} instead.
*/
declare function underscore<Content extends string>(content: Content): `__${Content}__`;
/**
* Formats the content into underlined text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function underline<Content extends string>(content: Content): `__${Content}__`;
/**
* Formats the content into strike-through text.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function strikethrough<Content extends string>(content: Content): `~~${Content}~~`;
/**
* Formats the content into a quote.
*
* @remarks This needs to be at the start of the line for Discord to format it.
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function quote<Content extends string>(content: Content): `> ${Content}`;
/**
* Formats the content into a block quote.
*
* @remarks This needs to be at the start of the line for Discord to format it.
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function blockQuote<Content extends string>(content: Content): `>>> ${Content}`;
/**
* Wraps the URL into `<>` which stops it from embedding.
*
* @typeParam Content - This is inferred by the supplied content
* @param url - The URL to wrap
*/
declare function hideLinkEmbed<Content extends string>(url: Content): `<${Content}>`;
/**
* Wraps the URL into `<>` which stops it from embedding.
*
* @param url - The URL to wrap
*/
declare function hideLinkEmbed(url: URL): `<${string}>`;
/**
* Formats the content and the URL into a masked URL.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to display
* @param url - The URL the content links to
*/
declare function hyperlink<Content extends string>(content: Content, url: URL): `[${Content}](${string})`;
/**
* Formats the content and the URL into a masked URL.
*
* @typeParam Content - This is inferred by the supplied content
* @typeParam Url - This is inferred by the supplied URL
* @param content - The content to display
* @param url - The URL the content links to
*/
declare function hyperlink<Content extends string, Url extends string>(content: Content, url: Url): `[${Content}](${Url})`;
/**
* Formats the content and the URL into a masked URL with a custom tooltip.
*
* @typeParam Content - This is inferred by the supplied content
* @typeParam Title - This is inferred by the supplied title
* @param content - The content to display
* @param url - The URL the content links to
* @param title - The title shown when hovering on the masked link
*/
declare function hyperlink<Content extends string, Title extends string>(content: Content, url: URL, title: Title): `[${Content}](${string} "${Title}")`;
/**
* Formats the content and the URL into a masked URL with a custom tooltip.
*
* @typeParam Content - This is inferred by the supplied content
* @typeParam Url - This is inferred by the supplied URL
* @typeParam Title - This is inferred by the supplied title
* @param content - The content to display
* @param url - The URL the content links to
* @param title - The title shown when hovering on the masked link
*/
declare function hyperlink<Content extends string, Url extends string, Title extends string>(content: Content, url: Url, title: Title): `[${Content}](${Url} "${Title}")`;
/**
* Formats the content into a spoiler.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
*/
declare function spoiler<Content extends string>(content: Content): `||${Content}||`;
/**
* Formats a user id into a user mention.
*
* @typeParam UserId - This is inferred by the supplied user id
* @param userId - The user id to format
*/
declare function userMention<UserId extends Snowflake>(userId: UserId): `<@${UserId}>`;
/**
* Formats a channel id into a channel mention.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @param channelId - The channel id to format
*/
declare function channelMention<ChannelId extends Snowflake>(channelId: ChannelId): `<#${ChannelId}>`;
/**
* Formats a role id into a role mention.
*
* @typeParam RoleId - This is inferred by the supplied role id
* @param roleId - The role id to format
*/
declare function roleMention<RoleId extends Snowflake>(roleId: RoleId): `<@&${RoleId}>`;
/**
* Formats an application command name, subcommand group name, subcommand name, and id into an application command mention.
*
* @typeParam CommandName - This is inferred by the supplied command name
* @typeParam SubcommandGroupName - This is inferred by the supplied subcommand group name
* @typeParam SubcommandName - This is inferred by the supplied subcommand name
* @typeParam CommandId - This is inferred by the supplied command id
* @param commandName - The application command name to format
* @param subcommandGroupName - The subcommand group name to format
* @param subcommandName - The subcommand name to format
* @param commandId - The application command id to format
*/
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}>`;
/**
* Formats an application command name, subcommand name, and id into an application command mention.
*
* @typeParam CommandName - This is inferred by the supplied command name
* @typeParam SubcommandName - This is inferred by the supplied subcommand name
* @typeParam CommandId - This is inferred by the supplied command id
* @param commandName - The application command name to format
* @param subcommandName - The subcommand name to format
* @param commandId - The application command id to format
*/
declare function chatInputApplicationCommandMention<CommandName extends string, SubcommandName extends string, CommandId extends Snowflake>(commandName: CommandName, subcommandName: SubcommandName, commandId: CommandId): `</${CommandName} ${SubcommandName}:${CommandId}>`;
/**
* Formats an application command name and id into an application command mention.
*
* @typeParam CommandName - This is inferred by the supplied command name
* @typeParam CommandId - This is inferred by the supplied command id
* @param commandName - The application command name to format
* @param commandId - The application command id to format
*/
declare function chatInputApplicationCommandMention<CommandName extends string, CommandId extends Snowflake>(commandName: CommandName, commandId: CommandId): `</${CommandName}:${CommandId}>`;
/**
* Formats a non-animated emoji id into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @param emojiId - The emoji id to format
*/
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: false): `<:_:${EmojiId}>`;
/**
* Formats an animated emoji id into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @param emojiId - The emoji id to format
* @param animated - Whether the emoji is animated
*/
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: true): `<a:_:${EmojiId}>`;
/**
* Formats an emoji id into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @param emojiId - The emoji id to format
* @param animated - Whether the emoji is animated
*/
declare function formatEmoji<EmojiId extends Snowflake>(emojiId: EmojiId, animated?: boolean): `<:_:${EmojiId}>` | `<a:_:${EmojiId}>`;
/**
* Formats a non-animated emoji id and name into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @typeParam EmojiName - This is inferred by the supplied name
* @param options - The options for formatting an emoji
*/
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName> & {
animated: true;
}): `<a:${EmojiName}:${EmojiId}>`;
/**
* Formats an animated emoji id and name into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @typeParam EmojiName - This is inferred by the supplied name
* @param options - The options for formatting an emoji
*/
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName> & {
animated?: false;
}): `<:${EmojiName}:${EmojiId}>`;
/**
* Formats an emoji id and name into a fully qualified emoji identifier.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @typeParam EmojiName - This is inferred by the supplied emoji name
* @param options - The options for formatting an emoji
*/
declare function formatEmoji<EmojiId extends Snowflake, EmojiName extends string>(options: FormatEmojiOptions<EmojiId, EmojiName>): `<:${EmojiName}:${EmojiId}>` | `<a:${EmojiName}:${EmojiId}>`;
/**
* The options for formatting an emoji.
*
* @typeParam EmojiId - This is inferred by the supplied emoji id
* @typeParam EmojiName - This is inferred by the supplied emoji name
*/
interface FormatEmojiOptions<EmojiId extends Snowflake, EmojiName extends string> {
/**
* Whether the emoji is animated
*/
animated?: boolean;
/**
* The emoji id to format
*/
id: EmojiId;
/**
* The name of the emoji
*/
name?: EmojiName;
}
/**
* Formats a channel link for a direct message channel.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @param channelId - The channel's id
*/
declare function channelLink<ChannelId extends Snowflake>(channelId: ChannelId): `https://discord.com/channels/@me/${ChannelId}`;
/**
* Formats a channel link for a guild channel.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @typeParam GuildId - This is inferred by the supplied guild id
* @param channelId - The channel's id
* @param guildId - The guild's id
*/
declare function channelLink<ChannelId extends Snowflake, GuildId extends Snowflake>(channelId: ChannelId, guildId: GuildId): `https://discord.com/channels/${GuildId}/${ChannelId}`;
/**
* Formats a message link for a direct message channel.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @typeParam MessageId - This is inferred by the supplied message id
* @param channelId - The channel's id
* @param messageId - The message's id
*/
declare function messageLink<ChannelId extends Snowflake, MessageId extends Snowflake>(channelId: ChannelId, messageId: MessageId): `https://discord.com/channels/@me/${ChannelId}/${MessageId}`;
/**
* Formats a message link for a guild channel.
*
* @typeParam ChannelId - This is inferred by the supplied channel id
* @typeParam MessageId - This is inferred by the supplied message id
* @typeParam GuildId - This is inferred by the supplied guild id
* @param channelId - The channel's id
* @param messageId - The message's id
* @param guildId - The guild's id
*/
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}`;
/**
* The heading levels for expanded markdown.
*/
declare enum HeadingLevel {
/**
* The first heading level.
*/
One = 1,
/**
* The second heading level.
*/
Two = 2,
/**
* The third heading level.
*/
Three = 3
}
/**
* Formats the content into a heading level.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
* @param level - The heading level
*/
declare function heading<Content extends string>(content: Content, level?: HeadingLevel.One): `# ${Content}`;
/**
* Formats the content into a heading level.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
* @param level - The heading level
*/
declare function heading<Content extends string>(content: Content, level: HeadingLevel.Two): `## ${Content}`;
/**
* Formats the content into a heading level.
*
* @typeParam Content - This is inferred by the supplied content
* @param content - The content to wrap
* @param level - The heading level
*/
declare function heading<Content extends string>(content: Content, level: HeadingLevel.Three): `### ${Content}`;
/**
* A type that recursively traverses into arrays.
*/
type RecursiveArray<ItemType> = readonly (ItemType | RecursiveArray<ItemType>)[];
/**
* Formats the elements in the array to an ordered list.
*
* @param list - The array of elements to list
* @param startNumber - The starting number for the list
*/
declare function orderedList(list: RecursiveArray<string>, startNumber?: number): string;
/**
* Formats the elements in the array to an unordered list.
*
* @param list - The array of elements to list
*/
declare function unorderedList(list: RecursiveArray<string>): string;
/**
* Formats a date into a short date-time string.
*
* @param date - The date to format. Defaults to the current time
*/
declare function time(date?: Date): `<t:${bigint}>`;
/**
* Formats a date given a format style.
*
* @typeParam Style - This is inferred by the supplied {@link TimestampStylesString}
* @param date - The date to format
* @param style - The style to use
*/
declare function time<Style extends TimestampStylesString>(date: Date, style: Style): `<t:${bigint}:${Style}>`;
/**
* Formats the given timestamp into a short date-time string.
*
* @typeParam Seconds - This is inferred by the supplied timestamp
* @param seconds - A Unix timestamp in seconds
*/
declare function time<Seconds extends number>(seconds: Seconds): `<t:${Seconds}>`;
/**
* Formats the given timestamp into a short date-time string.
*
* @typeParam Seconds - This is inferred by the supplied timestamp
* @typeParam Style - This is inferred by the supplied {@link TimestampStylesString}
* @param seconds - A Unix timestamp in seconds
* @param style - The style to use
*/
declare function time<Seconds extends number, Style extends TimestampStylesString>(seconds: Seconds, style: Style): `<t:${Seconds}:${Style}>`;
/**
* The {@link https://discord.com/developers/docs/reference#message-formatting-timestamp-styles | message formatting timestamp styles}
* supported by Discord.
*/
declare const TimestampStyles: {
/**
* Short time format, consisting of hours and minutes.
*
* @example `16:20`
*/
readonly ShortTime: "t";
/**
* Long time format, consisting of hours, minutes, and seconds.
*
* @example `16:20:30`
*/
readonly LongTime: "T";
/**
* Short date format, consisting of day, month, and year.
*
* @example `20/04/2021`
*/
readonly ShortDate: "d";
/**
* Long date format, consisting of day, month, and year.
*
* @example `20 April 2021`
*/
readonly LongDate: "D";
/**
* Short date-time format, consisting of short date and short time formats.
*
* @example `20 April 2021 16:20`
*/
readonly ShortDateTime: "f";
/**
* Long date-time format, consisting of long date and short time formats.
*
* @example `Tuesday, 20 April 2021 16:20`
*/
readonly LongDateTime: "F";
/**
* Relative time format, consisting of a relative duration format.
*
* @example `2 months ago`
*/
readonly RelativeTime: "R";
};
/**
* The possible {@link TimestampStyles} values.
*/
type TimestampStylesString = (typeof TimestampStyles)[keyof typeof TimestampStyles];
/**
* All the available faces from Discord's native slash commands.
*/
declare enum Faces {
/**
* `¯\_(ツ)_/¯`
*/
Shrug = "\u00AF\\_(\u30C4)_/\u00AF",
/**
* `(╯°□°)╯︵ ┻━┻`
*/
Tableflip = "(\u256F\u00B0\u25A1\u00B0)\u256F\uFE35 \u253B\u2501\u253B",
/**
* `┬─┬ノ( º _ ºノ)`
*/
Unflip = "\u252C\u2500\u252C\u30CE( \u00BA _ \u00BA\u30CE)"
}
/**
* All the available guild navigation mentions.
*/
declare enum GuildNavigationMentions {
/**
* Browse Channels tab.
*/
Browse = "<id:browse>",
/**
* Customize tab with the server's {@link https://discord.com/developers/docs/resources/guild#guild-onboarding-object | onboarding prompts}.
*/
Customize = "<id:customize>",
/**
* {@link https://support.discord.com/hc/articles/13497665141655 | Server Guide} tab.
*/
Guide = "<id:guide>"
}
/**
* The {@link https://github.com/discordjs/discord.js/blob/main/packages/formatters#readme | @discordjs/formatters} version
* that you are currently using.
*
* @privateRemarks This needs to explicitly be `string` so it is not typed as a "const string" that gets injected by esbuild.
*/
declare const version: string;
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 };

457
node_modules/@discordjs/formatters/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,457 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
Faces: () => Faces,
GuildNavigationMentions: () => GuildNavigationMentions,
HeadingLevel: () => HeadingLevel,
TimestampStyles: () => TimestampStyles,
blockQuote: () => blockQuote,
bold: () => bold,
channelLink: () => channelLink,
channelMention: () => channelMention,
chatInputApplicationCommandMention: () => chatInputApplicationCommandMention,
codeBlock: () => codeBlock,
escapeBold: () => escapeBold,
escapeBulletedList: () => escapeBulletedList,
escapeCodeBlock: () => escapeCodeBlock,
escapeEscape: () => escapeEscape,
escapeHeading: () => escapeHeading,
escapeInlineCode: () => escapeInlineCode,
escapeItalic: () => escapeItalic,
escapeMarkdown: () => escapeMarkdown,
escapeMaskedLink: () => escapeMaskedLink,
escapeNumberedList: () => escapeNumberedList,
escapeSpoiler: () => escapeSpoiler,
escapeStrikethrough: () => escapeStrikethrough,
escapeUnderline: () => escapeUnderline,
formatEmoji: () => formatEmoji,
heading: () => heading,
hideLinkEmbed: () => hideLinkEmbed,
hyperlink: () => hyperlink,
inlineCode: () => inlineCode,
italic: () => italic,
messageLink: () => messageLink,
orderedList: () => orderedList,
quote: () => quote,
roleMention: () => roleMention,
spoiler: () => spoiler,
strikethrough: () => strikethrough,
time: () => time,
underline: () => underline,
underscore: () => underscore,
unorderedList: () => unorderedList,
userMention: () => userMention,
version: () => version
});
module.exports = __toCommonJS(src_exports);
// src/escapers.ts
function escapeMarkdown(text, options = {}) {
const {
codeBlock: codeBlock2 = true,
inlineCode: inlineCode2 = true,
bold: bold2 = true,
italic: italic2 = true,
underline: underline2 = true,
strikethrough: strikethrough2 = true,
spoiler: spoiler2 = true,
codeBlockContent = true,
inlineCodeContent = true,
escape = true,
heading: heading2 = false,
bulletedList = false,
numberedList = false,
maskedLink = false
} = options;
if (!codeBlockContent) {
return text.split("```").map((subString, index, array) => {
if (index % 2 && index !== array.length - 1)
return subString;
return escapeMarkdown(subString, {
inlineCode: inlineCode2,
bold: bold2,
italic: italic2,
underline: underline2,
strikethrough: strikethrough2,
spoiler: spoiler2,
inlineCodeContent,
escape,
heading: heading2,
bulletedList,
numberedList,
maskedLink
});
}).join(codeBlock2 ? "\\`\\`\\`" : "```");
}
if (!inlineCodeContent) {
return text.split(/(?<=^|[^`])`(?=[^`]|$)/g).map((subString, index, array) => {
if (index % 2 && index !== array.length - 1)
return subString;
return escapeMarkdown(subString, {
codeBlock: codeBlock2,
bold: bold2,
italic: italic2,
underline: underline2,
strikethrough: strikethrough2,
spoiler: spoiler2,
escape,
heading: heading2,
bulletedList,
numberedList,
maskedLink
});
}).join(inlineCode2 ? "\\`" : "`");
}
let res = text;
if (escape)
res = escapeEscape(res);
if (inlineCode2)
res = escapeInlineCode(res);
if (codeBlock2)
res = escapeCodeBlock(res);
if (italic2)
res = escapeItalic(res);
if (bold2)
res = escapeBold(res);
if (underline2)
res = escapeUnderline(res);
if (strikethrough2)
res = escapeStrikethrough(res);
if (spoiler2)
res = escapeSpoiler(res);
if (heading2)
res = escapeHeading(res);
if (bulletedList)
res = escapeBulletedList(res);
if (numberedList)
res = escapeNumberedList(res);
if (maskedLink)
res = escapeMaskedLink(res);
return res;
}
__name(escapeMarkdown, "escapeMarkdown");
function escapeCodeBlock(text) {
return text.replaceAll("```", "\\`\\`\\`");
}
__name(escapeCodeBlock, "escapeCodeBlock");
function escapeInlineCode(text) {
return text.replaceAll(/(?<=^|[^`])``?(?=[^`]|$)/g, (match) => match.length === 2 ? "\\`\\`" : "\\`");
}
__name(escapeInlineCode, "escapeInlineCode");
function escapeItalic(text) {
let idx = 0;
const newText = text.replaceAll(/(?<=^|[^*])\*([^*]|\*\*|$)/g, (_, match) => {
if (match === "**")
return ++idx % 2 ? `\\*${match}` : `${match}\\*`;
return `\\*${match}`;
});
idx = 0;
return newText.replaceAll(/(?<=^|[^_])(?<!<a?:.+|https?:\/\/\S+)_(?!:\d+>)([^_]|__|$)/g, (_, match) => {
if (match === "__")
return ++idx % 2 ? `\\_${match}` : `${match}\\_`;
return `\\_${match}`;
});
}
__name(escapeItalic, "escapeItalic");
function escapeBold(text) {
let idx = 0;
return text.replaceAll(/\*\*(\*)?/g, (_, match) => {
if (match)
return ++idx % 2 ? `${match}\\*\\*` : `\\*\\*${match}`;
return "\\*\\*";
});
}
__name(escapeBold, "escapeBold");
function escapeUnderline(text) {
let idx = 0;
return text.replaceAll(/(?<!<a?:.+|https?:\/\/\S+)__(_)?(?!:\d+>)/g, (_, match) => {
if (match)
return ++idx % 2 ? `${match}\\_\\_` : `\\_\\_${match}`;
return "\\_\\_";
});
}
__name(escapeUnderline, "escapeUnderline");
function escapeStrikethrough(text) {
return text.replaceAll("~~", "\\~\\~");
}
__name(escapeStrikethrough, "escapeStrikethrough");
function escapeSpoiler(text) {
return text.replaceAll("||", "\\|\\|");
}
__name(escapeSpoiler, "escapeSpoiler");
function escapeEscape(text) {
return text.replaceAll("\\", "\\\\");
}
__name(escapeEscape, "escapeEscape");
function escapeHeading(text) {
return text.replaceAll(/^( {0,2})([*-] )?( *)(#{1,3} )/gm, "$1$2$3\\$4");
}
__name(escapeHeading, "escapeHeading");
function escapeBulletedList(text) {
return text.replaceAll(/^( *)([*-])( +)/gm, "$1\\$2$3");
}
__name(escapeBulletedList, "escapeBulletedList");
function escapeNumberedList(text) {
return text.replaceAll(/^( *\d+)\./gm, "$1\\.");
}
__name(escapeNumberedList, "escapeNumberedList");
function escapeMaskedLink(text) {
return text.replaceAll(/\[.+]\(.+\)/gm, "\\$&");
}
__name(escapeMaskedLink, "escapeMaskedLink");
// src/formatters.ts
function codeBlock(language, content) {
return content === void 0 ? `\`\`\`
${language}
\`\`\`` : `\`\`\`${language}
${content}
\`\`\``;
}
__name(codeBlock, "codeBlock");
function inlineCode(content) {
return `\`${content}\``;
}
__name(inlineCode, "inlineCode");
function italic(content) {
return `_${content}_`;
}
__name(italic, "italic");
function bold(content) {
return `**${content}**`;
}
__name(bold, "bold");
function underscore(content) {
return underline(content);
}
__name(underscore, "underscore");
function underline(content) {
return `__${content}__`;
}
__name(underline, "underline");
function strikethrough(content) {
return `~~${content}~~`;
}
__name(strikethrough, "strikethrough");
function quote(content) {
return `> ${content}`;
}
__name(quote, "quote");
function blockQuote(content) {
return `>>> ${content}`;
}
__name(blockQuote, "blockQuote");
function hideLinkEmbed(url) {
return `<${url}>`;
}
__name(hideLinkEmbed, "hideLinkEmbed");
function hyperlink(content, url, title) {
return title ? `[${content}](${url} "${title}")` : `[${content}](${url})`;
}
__name(hyperlink, "hyperlink");
function spoiler(content) {
return `||${content}||`;
}
__name(spoiler, "spoiler");
function userMention(userId) {
return `<@${userId}>`;
}
__name(userMention, "userMention");
function channelMention(channelId) {
return `<#${channelId}>`;
}
__name(channelMention, "channelMention");
function roleMention(roleId) {
return `<@&${roleId}>`;
}
__name(roleMention, "roleMention");
function chatInputApplicationCommandMention(commandName, subcommandGroupName, subcommandName, commandId) {
if (commandId !== void 0) {
return `</${commandName} ${subcommandGroupName} ${subcommandName}:${commandId}>`;
}
if (subcommandName !== void 0) {
return `</${commandName} ${subcommandGroupName}:${subcommandName}>`;
}
return `</${commandName}:${subcommandGroupName}>`;
}
__name(chatInputApplicationCommandMention, "chatInputApplicationCommandMention");
function formatEmoji(emojiIdOrOptions, animated) {
const options = typeof emojiIdOrOptions === "string" ? {
id: emojiIdOrOptions,
animated: animated ?? false
} : emojiIdOrOptions;
const { id, animated: isAnimated, name: emojiName } = options;
return `<${isAnimated ? "a" : ""}:${emojiName ?? "_"}:${id}>`;
}
__name(formatEmoji, "formatEmoji");
function channelLink(channelId, guildId) {
return `https://discord.com/channels/${guildId ?? "@me"}/${channelId}`;
}
__name(channelLink, "channelLink");
function messageLink(channelId, messageId, guildId) {
return `${guildId === void 0 ? channelLink(channelId) : channelLink(channelId, guildId)}/${messageId}`;
}
__name(messageLink, "messageLink");
var HeadingLevel = /* @__PURE__ */ ((HeadingLevel2) => {
HeadingLevel2[HeadingLevel2["One"] = 1] = "One";
HeadingLevel2[HeadingLevel2["Two"] = 2] = "Two";
HeadingLevel2[HeadingLevel2["Three"] = 3] = "Three";
return HeadingLevel2;
})(HeadingLevel || {});
function heading(content, level) {
switch (level) {
case 3 /* Three */:
return `### ${content}`;
case 2 /* Two */:
return `## ${content}`;
default:
return `# ${content}`;
}
}
__name(heading, "heading");
function listCallback(element, startNumber, depth = 0) {
if (Array.isArray(element)) {
return element.map((element2) => listCallback(element2, startNumber, depth + 1)).join("\n");
}
return `${" ".repeat(depth - 1)}${startNumber ? `${startNumber}.` : "-"} ${element}`;
}
__name(listCallback, "listCallback");
function orderedList(list, startNumber = 1) {
return listCallback(list, Math.max(startNumber, 1));
}
__name(orderedList, "orderedList");
function unorderedList(list) {
return listCallback(list);
}
__name(unorderedList, "unorderedList");
function time(timeOrSeconds, style) {
if (typeof timeOrSeconds !== "number") {
timeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1e3);
}
return typeof style === "string" ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;
}
__name(time, "time");
var TimestampStyles = {
/**
* Short time format, consisting of hours and minutes.
*
* @example `16:20`
*/
ShortTime: "t",
/**
* Long time format, consisting of hours, minutes, and seconds.
*
* @example `16:20:30`
*/
LongTime: "T",
/**
* Short date format, consisting of day, month, and year.
*
* @example `20/04/2021`
*/
ShortDate: "d",
/**
* Long date format, consisting of day, month, and year.
*
* @example `20 April 2021`
*/
LongDate: "D",
/**
* Short date-time format, consisting of short date and short time formats.
*
* @example `20 April 2021 16:20`
*/
ShortDateTime: "f",
/**
* Long date-time format, consisting of long date and short time formats.
*
* @example `Tuesday, 20 April 2021 16:20`
*/
LongDateTime: "F",
/**
* Relative time format, consisting of a relative duration format.
*
* @example `2 months ago`
*/
RelativeTime: "R"
};
var Faces = /* @__PURE__ */ ((Faces2) => {
Faces2["Shrug"] = "\xAF\\_(\u30C4)_/\xAF";
Faces2["Tableflip"] = "(\u256F\xB0\u25A1\xB0)\u256F\uFE35 \u253B\u2501\u253B";
Faces2["Unflip"] = "\u252C\u2500\u252C\u30CE( \xBA _ \xBA\u30CE)";
return Faces2;
})(Faces || {});
var GuildNavigationMentions = /* @__PURE__ */ ((GuildNavigationMentions2) => {
GuildNavigationMentions2["Browse"] = "<id:browse>";
GuildNavigationMentions2["Customize"] = "<id:customize>";
GuildNavigationMentions2["Guide"] = "<id:guide>";
return GuildNavigationMentions2;
})(GuildNavigationMentions || {});
// src/index.ts
var version = "0.4.0";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Faces,
GuildNavigationMentions,
HeadingLevel,
TimestampStyles,
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
});
//# sourceMappingURL=index.js.map

1
node_modules/@discordjs/formatters/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

392
node_modules/@discordjs/formatters/dist/index.mjs generated vendored Normal file
View file

@ -0,0 +1,392 @@
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
// src/escapers.ts
function escapeMarkdown(text, options = {}) {
const {
codeBlock: codeBlock2 = true,
inlineCode: inlineCode2 = true,
bold: bold2 = true,
italic: italic2 = true,
underline: underline2 = true,
strikethrough: strikethrough2 = true,
spoiler: spoiler2 = true,
codeBlockContent = true,
inlineCodeContent = true,
escape = true,
heading: heading2 = false,
bulletedList = false,
numberedList = false,
maskedLink = false
} = options;
if (!codeBlockContent) {
return text.split("```").map((subString, index, array) => {
if (index % 2 && index !== array.length - 1)
return subString;
return escapeMarkdown(subString, {
inlineCode: inlineCode2,
bold: bold2,
italic: italic2,
underline: underline2,
strikethrough: strikethrough2,
spoiler: spoiler2,
inlineCodeContent,
escape,
heading: heading2,
bulletedList,
numberedList,
maskedLink
});
}).join(codeBlock2 ? "\\`\\`\\`" : "```");
}
if (!inlineCodeContent) {
return text.split(/(?<=^|[^`])`(?=[^`]|$)/g).map((subString, index, array) => {
if (index % 2 && index !== array.length - 1)
return subString;
return escapeMarkdown(subString, {
codeBlock: codeBlock2,
bold: bold2,
italic: italic2,
underline: underline2,
strikethrough: strikethrough2,
spoiler: spoiler2,
escape,
heading: heading2,
bulletedList,
numberedList,
maskedLink
});
}).join(inlineCode2 ? "\\`" : "`");
}
let res = text;
if (escape)
res = escapeEscape(res);
if (inlineCode2)
res = escapeInlineCode(res);
if (codeBlock2)
res = escapeCodeBlock(res);
if (italic2)
res = escapeItalic(res);
if (bold2)
res = escapeBold(res);
if (underline2)
res = escapeUnderline(res);
if (strikethrough2)
res = escapeStrikethrough(res);
if (spoiler2)
res = escapeSpoiler(res);
if (heading2)
res = escapeHeading(res);
if (bulletedList)
res = escapeBulletedList(res);
if (numberedList)
res = escapeNumberedList(res);
if (maskedLink)
res = escapeMaskedLink(res);
return res;
}
__name(escapeMarkdown, "escapeMarkdown");
function escapeCodeBlock(text) {
return text.replaceAll("```", "\\`\\`\\`");
}
__name(escapeCodeBlock, "escapeCodeBlock");
function escapeInlineCode(text) {
return text.replaceAll(/(?<=^|[^`])``?(?=[^`]|$)/g, (match) => match.length === 2 ? "\\`\\`" : "\\`");
}
__name(escapeInlineCode, "escapeInlineCode");
function escapeItalic(text) {
let idx = 0;
const newText = text.replaceAll(/(?<=^|[^*])\*([^*]|\*\*|$)/g, (_, match) => {
if (match === "**")
return ++idx % 2 ? `\\*${match}` : `${match}\\*`;
return `\\*${match}`;
});
idx = 0;
return newText.replaceAll(/(?<=^|[^_])(?<!<a?:.+|https?:\/\/\S+)_(?!:\d+>)([^_]|__|$)/g, (_, match) => {
if (match === "__")
return ++idx % 2 ? `\\_${match}` : `${match}\\_`;
return `\\_${match}`;
});
}
__name(escapeItalic, "escapeItalic");
function escapeBold(text) {
let idx = 0;
return text.replaceAll(/\*\*(\*)?/g, (_, match) => {
if (match)
return ++idx % 2 ? `${match}\\*\\*` : `\\*\\*${match}`;
return "\\*\\*";
});
}
__name(escapeBold, "escapeBold");
function escapeUnderline(text) {
let idx = 0;
return text.replaceAll(/(?<!<a?:.+|https?:\/\/\S+)__(_)?(?!:\d+>)/g, (_, match) => {
if (match)
return ++idx % 2 ? `${match}\\_\\_` : `\\_\\_${match}`;
return "\\_\\_";
});
}
__name(escapeUnderline, "escapeUnderline");
function escapeStrikethrough(text) {
return text.replaceAll("~~", "\\~\\~");
}
__name(escapeStrikethrough, "escapeStrikethrough");
function escapeSpoiler(text) {
return text.replaceAll("||", "\\|\\|");
}
__name(escapeSpoiler, "escapeSpoiler");
function escapeEscape(text) {
return text.replaceAll("\\", "\\\\");
}
__name(escapeEscape, "escapeEscape");
function escapeHeading(text) {
return text.replaceAll(/^( {0,2})([*-] )?( *)(#{1,3} )/gm, "$1$2$3\\$4");
}
__name(escapeHeading, "escapeHeading");
function escapeBulletedList(text) {
return text.replaceAll(/^( *)([*-])( +)/gm, "$1\\$2$3");
}
__name(escapeBulletedList, "escapeBulletedList");
function escapeNumberedList(text) {
return text.replaceAll(/^( *\d+)\./gm, "$1\\.");
}
__name(escapeNumberedList, "escapeNumberedList");
function escapeMaskedLink(text) {
return text.replaceAll(/\[.+]\(.+\)/gm, "\\$&");
}
__name(escapeMaskedLink, "escapeMaskedLink");
// src/formatters.ts
function codeBlock(language, content) {
return content === void 0 ? `\`\`\`
${language}
\`\`\`` : `\`\`\`${language}
${content}
\`\`\``;
}
__name(codeBlock, "codeBlock");
function inlineCode(content) {
return `\`${content}\``;
}
__name(inlineCode, "inlineCode");
function italic(content) {
return `_${content}_`;
}
__name(italic, "italic");
function bold(content) {
return `**${content}**`;
}
__name(bold, "bold");
function underscore(content) {
return underline(content);
}
__name(underscore, "underscore");
function underline(content) {
return `__${content}__`;
}
__name(underline, "underline");
function strikethrough(content) {
return `~~${content}~~`;
}
__name(strikethrough, "strikethrough");
function quote(content) {
return `> ${content}`;
}
__name(quote, "quote");
function blockQuote(content) {
return `>>> ${content}`;
}
__name(blockQuote, "blockQuote");
function hideLinkEmbed(url) {
return `<${url}>`;
}
__name(hideLinkEmbed, "hideLinkEmbed");
function hyperlink(content, url, title) {
return title ? `[${content}](${url} "${title}")` : `[${content}](${url})`;
}
__name(hyperlink, "hyperlink");
function spoiler(content) {
return `||${content}||`;
}
__name(spoiler, "spoiler");
function userMention(userId) {
return `<@${userId}>`;
}
__name(userMention, "userMention");
function channelMention(channelId) {
return `<#${channelId}>`;
}
__name(channelMention, "channelMention");
function roleMention(roleId) {
return `<@&${roleId}>`;
}
__name(roleMention, "roleMention");
function chatInputApplicationCommandMention(commandName, subcommandGroupName, subcommandName, commandId) {
if (commandId !== void 0) {
return `</${commandName} ${subcommandGroupName} ${subcommandName}:${commandId}>`;
}
if (subcommandName !== void 0) {
return `</${commandName} ${subcommandGroupName}:${subcommandName}>`;
}
return `</${commandName}:${subcommandGroupName}>`;
}
__name(chatInputApplicationCommandMention, "chatInputApplicationCommandMention");
function formatEmoji(emojiIdOrOptions, animated) {
const options = typeof emojiIdOrOptions === "string" ? {
id: emojiIdOrOptions,
animated: animated ?? false
} : emojiIdOrOptions;
const { id, animated: isAnimated, name: emojiName } = options;
return `<${isAnimated ? "a" : ""}:${emojiName ?? "_"}:${id}>`;
}
__name(formatEmoji, "formatEmoji");
function channelLink(channelId, guildId) {
return `https://discord.com/channels/${guildId ?? "@me"}/${channelId}`;
}
__name(channelLink, "channelLink");
function messageLink(channelId, messageId, guildId) {
return `${guildId === void 0 ? channelLink(channelId) : channelLink(channelId, guildId)}/${messageId}`;
}
__name(messageLink, "messageLink");
var HeadingLevel = /* @__PURE__ */ ((HeadingLevel2) => {
HeadingLevel2[HeadingLevel2["One"] = 1] = "One";
HeadingLevel2[HeadingLevel2["Two"] = 2] = "Two";
HeadingLevel2[HeadingLevel2["Three"] = 3] = "Three";
return HeadingLevel2;
})(HeadingLevel || {});
function heading(content, level) {
switch (level) {
case 3 /* Three */:
return `### ${content}`;
case 2 /* Two */:
return `## ${content}`;
default:
return `# ${content}`;
}
}
__name(heading, "heading");
function listCallback(element, startNumber, depth = 0) {
if (Array.isArray(element)) {
return element.map((element2) => listCallback(element2, startNumber, depth + 1)).join("\n");
}
return `${" ".repeat(depth - 1)}${startNumber ? `${startNumber}.` : "-"} ${element}`;
}
__name(listCallback, "listCallback");
function orderedList(list, startNumber = 1) {
return listCallback(list, Math.max(startNumber, 1));
}
__name(orderedList, "orderedList");
function unorderedList(list) {
return listCallback(list);
}
__name(unorderedList, "unorderedList");
function time(timeOrSeconds, style) {
if (typeof timeOrSeconds !== "number") {
timeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1e3);
}
return typeof style === "string" ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;
}
__name(time, "time");
var TimestampStyles = {
/**
* Short time format, consisting of hours and minutes.
*
* @example `16:20`
*/
ShortTime: "t",
/**
* Long time format, consisting of hours, minutes, and seconds.
*
* @example `16:20:30`
*/
LongTime: "T",
/**
* Short date format, consisting of day, month, and year.
*
* @example `20/04/2021`
*/
ShortDate: "d",
/**
* Long date format, consisting of day, month, and year.
*
* @example `20 April 2021`
*/
LongDate: "D",
/**
* Short date-time format, consisting of short date and short time formats.
*
* @example `20 April 2021 16:20`
*/
ShortDateTime: "f",
/**
* Long date-time format, consisting of long date and short time formats.
*
* @example `Tuesday, 20 April 2021 16:20`
*/
LongDateTime: "F",
/**
* Relative time format, consisting of a relative duration format.
*
* @example `2 months ago`
*/
RelativeTime: "R"
};
var Faces = /* @__PURE__ */ ((Faces2) => {
Faces2["Shrug"] = "\xAF\\_(\u30C4)_/\xAF";
Faces2["Tableflip"] = "(\u256F\xB0\u25A1\xB0)\u256F\uFE35 \u253B\u2501\u253B";
Faces2["Unflip"] = "\u252C\u2500\u252C\u30CE( \xBA _ \xBA\u30CE)";
return Faces2;
})(Faces || {});
var GuildNavigationMentions = /* @__PURE__ */ ((GuildNavigationMentions2) => {
GuildNavigationMentions2["Browse"] = "<id:browse>";
GuildNavigationMentions2["Customize"] = "<id:customize>";
GuildNavigationMentions2["Guide"] = "<id:guide>";
return GuildNavigationMentions2;
})(GuildNavigationMentions || {});
// src/index.ts
var version = "0.4.0";
export {
Faces,
GuildNavigationMentions,
HeadingLevel,
TimestampStyles,
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
};
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

83
node_modules/@discordjs/formatters/package.json generated vendored Normal file
View file

@ -0,0 +1,83 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@discordjs/formatters",
"version": "0.4.0",
"description": "A set of functions to format strings for Discord.",
"exports": {
".": {
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
}
}
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"directories": {
"lib": "src",
"test": "__tests__"
},
"files": [
"dist"
],
"contributors": [
"Crawl <icrawltogo@gmail.com>",
"SpaceEEC <spaceeec@yahoo.com>",
"Vlad Frangu <kingdgrizzle@gmail.com>",
"Aura Román <kyradiscord@gmail.com>"
],
"license": "Apache-2.0",
"keywords": [],
"repository": {
"type": "git",
"url": "https://github.com/discordjs/discord.js.git",
"directory": "packages/formatters"
},
"bugs": {
"url": "https://github.com/discordjs/discord.js/issues"
},
"homepage": "https://discord.js.org",
"funding": "https://github.com/discordjs/discord.js?sponsor",
"dependencies": {
"discord-api-types": "0.37.83"
},
"devDependencies": {
"@favware/cliff-jumper": "^3.0.2",
"@types/node": "16.18.60",
"@vitest/coverage-v8": "^1.5.0",
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.1",
"eslint": "^8.57.0",
"eslint-config-neon": "^0.1.62",
"eslint-formatter-pretty": "^6.0.1",
"prettier": "^3.2.5",
"tsup": "^8.0.2",
"turbo": "^1.13.2",
"typescript": "^5.4.5",
"vitest": "^1.5.0",
"@discordjs/scripts": "^0.1.0",
"@discordjs/api-extractor": "^7.38.1"
},
"engines": {
"node": ">=16.11.0"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"scripts": {
"test": "vitest run",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "pnpm run build:docs && api-extractor run --local --minify && generate-split-documentation",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/formatters/*'",
"release": "cliff-jumper"
}
}