Commit 65666f7a authored by Rasmus Bengtsson's avatar Rasmus Bengtsson
Browse files

added basic dep

parent b40acec3
../typescript/bin/tsc
\ No newline at end of file
../typescript/bin/tsserver
\ No newline at end of file
{
"systemParams": "linux-x64-93",
"modulesFolders": [
"node_modules"
],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [
"@typeit/discord@^5.0.13",
"@types/node@^16.9.1",
"discord.js@^13.1.0",
"tslib@^2.3.1",
"typescript@^4.4.3"
],
"lockfileEntries": {
"@discordjs/builders@^0.5.0": "https://registry.yarnpkg.com/@discordjs/builders/-/builders-0.5.0.tgz#646cbea9cc67f68639e6fb70ed1278b26dacdb14",
"@discordjs/collection@^0.2.1": "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.2.1.tgz#ea4bc7b41b7b7b6daa82e439141222ec95c469b2",
"@discordjs/form-data@^3.0.1": "https://registry.yarnpkg.com/@discordjs/form-data/-/form-data-3.0.1.tgz#5c9e6be992e2e57d0dfa0e39979a850225fb4697",
"@sapphire/async-queue@^1.1.4": "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.1.4.tgz#ae431310917a8880961cebe8e59df6ffa40f2957",
"@sindresorhus/is@^4.0.1": "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.1.0.tgz#3853c0c48b47f0ebcdd3cd9a66fdd0d277173e78",
"@typeit/discord@^5.0.13": "https://registry.yarnpkg.com/@typeit/discord/-/discord-5.0.13.tgz#a4cf6c1c4e8d3adddb23eba16b8adc8f5659dafd",
"@types/node@*": "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708",
"@types/node@^16.9.1": "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708",
"@types/ws@^7.4.7": "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.7.tgz#f7c390a36f7a0679aa69de2d501319f4f8d9b702",
"asynckit@^0.4.0": "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79",
"balanced-match@^1.0.0": "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee",
"brace-expansion@^1.1.7": "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd",
"callsites@^3.1.0": "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73",
"combined-stream@^1.0.8": "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f",
"concat-map@0.0.1": "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b",
"delayed-stream@~1.0.0": "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619",
"discord-api-types@^0.18.1": "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.18.1.tgz#5d08ed1263236be9c21a22065d0e6b51f790f492",
"discord-api-types@^0.22.0": "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.22.0.tgz#34dc57fe8e016e5eaac5e393646cd42a7e1ccc2a",
"discord.js@^13.1.0": "https://registry.yarnpkg.com/discord.js/-/discord.js-13.1.0.tgz#99f6a2a8be88d31906ff0148e9b1cb603ebb2e2e",
"discord.js@github:discordjs/discord.js": "https://codeload.github.com/discordjs/discord.js/tar.gz/be8912a4219d1c1aa59a8060707973e567b7b5a3",
"dot-prop@^6.0.1": "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083",
"fs.realpath@^1.0.0": "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f",
"glob@^7.1.7": "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90",
"inflight@^1.0.4": "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9",
"inherits@2": "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c",
"is-obj@^2.0.0": "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982",
"lodash.isequal@^4.5.0": "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0",
"mime-db@1.49.0": "https://registry.yarnpkg.com/mime-db/-/mime-db-1.49.0.tgz#f3dfde60c99e9cf3bc9701d687778f537001cbed",
"mime-types@^2.1.12": "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.32.tgz#1d00e89e7de7fe02008db61001d9e02852670fd5",
"minimatch@^3.0.4": "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083",
"node-fetch@^2.6.1": "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.2.tgz#986996818b73785e47b1965cc34eb093a1d464d0",
"once@^1.3.0": "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1",
"ow@^0.27.0": "https://registry.yarnpkg.com/ow/-/ow-0.27.0.tgz#d44da088e8184fa11de64b5813206f9f86ab68d0",
"path-is-absolute@^1.0.0": "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f",
"ts-mixer@^6.0.0": "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.0.tgz#4e631d3a36e3fa9521b973b132e8353bc7267f9f",
"tslib@^2.3.0": "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01",
"tslib@^2.3.1": "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01",
"type-fest@^1.2.1": "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1",
"typescript@^4.4.3": "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324",
"vali-date@^1.0.0": "https://registry.yarnpkg.com/vali-date/-/vali-date-1.0.0.tgz#1b904a59609fb328ef078138420934f6b86709a6",
"wrappy@1": "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f",
"ws@^7.5.1": "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881"
},
"files": [],
"artifacts": {}
}
\ No newline at end of file
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 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.
<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://github.com/discordjs/builders/actions"><img src="https://github.com/discordjs/builders/workflows/Tests/badge.svg" alt="Test status" /></a>
<a href="https://github.com/discordjs/builders/actions"><img src="https://github.com/discordjs/builders/workflows/Lint/badge.svg" alt="Lint status" /></a>
<a href="https://codecov.io/gh/discordjs/builders"><img src="https://codecov.io/gh/discordjs/builders/branch/main/graph/badge.svg" alt="Code coverage" /></a>
</p>
</div>
## Installation
Install with [npm](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/):
```sh
npm install @discordjs/builders
yarn add @discordjs/builders
pnpm add @discordjs/builders
```
## Contribution
See [Contributing Guide](https://github.com/discordjs/builders/blob/main/.github/CONTRIBUTING.md).
## Examples
Here are some examples for the builders and utilities you can find in this package:
- [Slash Command Builders](./docs/examples/Slash%20Command%20Builders.md)
export * from './messages/formatters';
export * as SlashCommandAssertions from './interactions/slashCommands/Assertions';
export * from './interactions/slashCommands/SlashCommandBuilder';
export * from './interactions/slashCommands/SlashCommandSubcommands';
export * from './interactions/slashCommands/options/boolean';
export * from './interactions/slashCommands/options/channel';
export * from './interactions/slashCommands/options/integer';
export * from './interactions/slashCommands/options/mentionable';
export * from './interactions/slashCommands/options/role';
export * from './interactions/slashCommands/options/string';
export * from './interactions/slashCommands/options/user';
//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AAEtC,OAAO,KAAK,sBAAsB,MAAM,yCAAyC,CAAC;AAClF,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SlashCommandAssertions = void 0;
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./messages/formatters"), exports);
exports.SlashCommandAssertions = tslib_1.__importStar(require("./interactions/slashCommands/Assertions"));
tslib_1.__exportStar(require("./interactions/slashCommands/SlashCommandBuilder"), exports);
tslib_1.__exportStar(require("./interactions/slashCommands/SlashCommandSubcommands"), exports);
tslib_1.__exportStar(require("./interactions/slashCommands/options/boolean"), exports);
tslib_1.__exportStar(require("./interactions/slashCommands/options/channel"), exports);
tslib_1.__exportStar(require("./interactions/slashCommands/options/integer"), exports);
tslib_1.__exportStar(require("./interactions/slashCommands/options/mentionable"), exports);
tslib_1.__exportStar(require("./interactions/slashCommands/options/role"), exports);
tslib_1.__exportStar(require("./interactions/slashCommands/options/string"), exports);
tslib_1.__exportStar(require("./interactions/slashCommands/options/user"), exports);
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,gEAAsC;AAEtC,0GAAkF;AAClF,2FAAiE;AACjE,+FAAqE;AACrE,uFAA6D;AAC7D,uFAA6D;AAC7D,uFAA6D;AAC7D,2FAAiE;AACjE,oFAA0D;AAC1D,sFAA4D;AAC5D,oFAA0D","sourcesContent":["export * from './messages/formatters';\n\nexport * as SlashCommandAssertions from './interactions/slashCommands/Assertions';\nexport * from './interactions/slashCommands/SlashCommandBuilder';\nexport * from './interactions/slashCommands/SlashCommandSubcommands';\nexport * from './interactions/slashCommands/options/boolean';\nexport * from './interactions/slashCommands/options/channel';\nexport * from './interactions/slashCommands/options/integer';\nexport * from './interactions/slashCommands/options/mentionable';\nexport * from './interactions/slashCommands/options/role';\nexport * from './interactions/slashCommands/options/string';\nexport * from './interactions/slashCommands/options/user';\n"]}
\ No newline at end of file
import mod from "./index.js";
export default mod;
export const Faces = mod.Faces;
export const SlashCommandAssertions = mod.SlashCommandAssertions;
export const SlashCommandBooleanOption = mod.SlashCommandBooleanOption;
export const SlashCommandBuilder = mod.SlashCommandBuilder;
export const SlashCommandChannelOption = mod.SlashCommandChannelOption;
export const SlashCommandIntegerOption = mod.SlashCommandIntegerOption;
export const SlashCommandMentionableOption = mod.SlashCommandMentionableOption;
export const SlashCommandRoleOption = mod.SlashCommandRoleOption;
export const SlashCommandStringOption = mod.SlashCommandStringOption;
export const SlashCommandSubcommandBuilder = mod.SlashCommandSubcommandBuilder;
export const SlashCommandSubcommandGroupBuilder = mod.SlashCommandSubcommandGroupBuilder;
export const SlashCommandUserOption = mod.SlashCommandUserOption;
export const TimestampStyles = mod.TimestampStyles;
export const blockQuote = mod.blockQuote;
export const bold = mod.bold;
export const channelMention = mod.channelMention;
export const codeBlock = mod.codeBlock;
export const formatEmoji = mod.formatEmoji;
export const hideLinkEmbed = mod.hideLinkEmbed;
export const hyperlink = mod.hyperlink;
export const inlineCode = mod.inlineCode;
export const italic = mod.italic;
export const memberNicknameMention = mod.memberNicknameMention;
export const quote = mod.quote;
export const roleMention = mod.roleMention;
export const spoiler = mod.spoiler;
export const strikethrough = mod.strikethrough;
export const time = mod.time;
export const underscore = mod.underscore;
export const userMention = mod.userMention;
import type { APIApplicationCommandOptionChoice } from 'discord-api-types/v9';
import type { SlashCommandOptionBase } from './mixins/CommandOptionBase';
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';
import type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
export declare function validateRequiredParameters(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
export declare function validateName(name: unknown): asserts name is string;
export declare function validateDescription(description: unknown): asserts description is string;
export declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
export declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
export declare function assertReturnOfBuilder<T extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
//# sourceMappingURL=Assertions.d.ts.map
\ No newline at end of file
{"version":3,"file":"Assertions.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/Assertions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAEnH,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,8BAA8B,EAAE,QAUzC;AAUD,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAElE;AAID,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,CAEvF;AAID,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,8BAA8B,EAAE,CAE9G;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iCAAiC,EAAE,QAEpF;AAED,wBAAgB,qBAAqB,CACpC,CAAC,SAAS,sBAAsB,GAAG,6BAA6B,GAAG,kCAAkC,EACpG,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAuBrE"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertReturnOfBuilder = exports.validateMaxChoicesLength = exports.validateMaxOptionsLength = exports.validateDescription = exports.validateName = exports.validateRequiredParameters = void 0;
const tslib_1 = require("tslib");
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
const ow_1 = tslib_1.__importDefault(require("ow"));
function validateRequiredParameters(name, description, options) {
// Assert name matches all conditions
validateName(name);
// Assert description conditions
validateDescription(description);
// Assert options conditions
validateMaxOptionsLength(options);
}
exports.validateRequiredParameters = validateRequiredParameters;
const namePredicate = ow_1.default.string.lowercase
.minLength(1)
.maxLength(32)
.addValidator({
message: (value, label) => `Expected ${label} to match "^[\\p{L}\\p{N}_-]+$", got ${value} instead`,
validator: (value) => /^[\p{L}\p{N}_-]+$/u.test(value),
});
function validateName(name) {
ow_1.default(name, 'name', namePredicate);
}
exports.validateName = validateName;
const descriptionPredicate = ow_1.default.string.minLength(1).maxLength(100);
function validateDescription(description) {
ow_1.default(description, 'description', descriptionPredicate);
}
exports.validateDescription = validateDescription;
const maxArrayLengthPredicate = ow_1.default.array.maxLength(25);
function validateMaxOptionsLength(options) {
ow_1.default(options, 'options', maxArrayLengthPredicate);
}
exports.validateMaxOptionsLength = validateMaxOptionsLength;
function validateMaxChoicesLength(choices) {
ow_1.default(choices, 'choices', maxArrayLengthPredicate);
}
exports.validateMaxChoicesLength = validateMaxChoicesLength;
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
const instanceName = ExpectedInstanceOf.name;
if (is_1.default.nullOrUndefined(input)) {
throw new TypeError(`Expected to receive a ${instanceName} builder, got ${input === null ? 'null' : 'undefined'} instead.`);
}
if (is_1.default.primitive(input)) {
throw new TypeError(`Expected to receive a ${instanceName} builder, got a primitive (${typeof input}) instead.`);
}
if (!(input instanceof ExpectedInstanceOf)) {
const casted = input;
const constructorName = is_1.default.function_(input) ? input.name : casted.constructor.name;
const stringTag = Reflect.get(casted, Symbol.toStringTag);
const fullResultName = stringTag ? `${constructorName} [${stringTag}]` : constructorName;
throw new TypeError(`Expected to receive a ${instanceName} builder, got ${fullResultName} instead.`);
}
}
exports.assertReturnOfBuilder = assertReturnOfBuilder;
//# sourceMappingURL=Assertions.js.map
\ No newline at end of file
{"version":3,"file":"Assertions.js","sourceRoot":"/","sources":["interactions/slashCommands/Assertions.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAElC,oDAAoB;AAKpB,SAAgB,0BAA0B,CACzC,IAAY,EACZ,WAAmB,EACnB,OAAyC;IAEzC,qCAAqC;IACrC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEnB,gCAAgC;IAChC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAEjC,4BAA4B;IAC5B,wBAAwB,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAbD,gEAaC;AAED,MAAM,aAAa,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS;KACvC,SAAS,CAAC,CAAC,CAAC;KACZ,SAAS,CAAC,EAAE,CAAC;KACb,YAAY,CAAC;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,YAAY,KAAM,wCAAwC,KAAK,UAAU;IACpG,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;CACtD,CAAC,CAAC;AAEJ,SAAgB,YAAY,CAAC,IAAa;IACzC,YAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AACjC,CAAC;AAFD,oCAEC;AAED,MAAM,oBAAoB,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAEnE,SAAgB,mBAAmB,CAAC,WAAoB;IACvD,YAAE,CAAC,WAAW,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAFD,kDAEC;AAED,MAAM,uBAAuB,GAAG,YAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AAEvD,SAAgB,wBAAwB,CAAC,OAAgB;IACxD,YAAE,CAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACjD,CAAC;AAFD,4DAEC;AAED,SAAgB,wBAAwB,CAAC,OAA4C;IACpF,YAAE,CAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACjD,CAAC;AAFD,4DAEC;AAED,SAAgB,qBAAqB,CAEnC,KAAc,EAAE,kBAA+B;IAChD,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAE7C,IAAI,YAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;QAC9B,MAAM,IAAI,SAAS,CAClB,yBAAyB,YAAY,iBAAiB,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,WAAW,CACtG,CAAC;KACF;IAED,IAAI,YAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACxB,MAAM,IAAI,SAAS,CAAC,yBAAyB,YAAY,8BAA8B,OAAO,KAAK,YAAY,CAAC,CAAC;KACjH;IAED,IAAI,CAAC,CAAC,KAAK,YAAY,kBAAkB,CAAC,EAAE;QAC3C,MAAM,MAAM,GAAG,KAAqC,CAAC;QAErD,MAAM,eAAe,GAAG,YAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;QACnF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAuB,CAAC;QAEhF,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,KAAK,SAAS,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC;QAEzF,MAAM,IAAI,SAAS,CAAC,yBAAyB,YAAY,iBAAiB,cAAc,WAAW,CAAC,CAAC;KACrG;AACF,CAAC;AAzBD,sDAyBC","sourcesContent":["import is from '@sindresorhus/is';\nimport type { APIApplicationCommandOptionChoice } from 'discord-api-types/v9';\nimport ow from 'ow';\nimport type { SlashCommandOptionBase } from './mixins/CommandOptionBase';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';\nimport type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\n\nexport function validateRequiredParameters(\n\tname: string,\n\tdescription: string,\n\toptions: ToAPIApplicationCommandOptions[],\n) {\n\t// Assert name matches all conditions\n\tvalidateName(name);\n\n\t// Assert description conditions\n\tvalidateDescription(description);\n\n\t// Assert options conditions\n\tvalidateMaxOptionsLength(options);\n}\n\nconst namePredicate = ow.string.lowercase\n\t.minLength(1)\n\t.maxLength(32)\n\t.addValidator({\n\t\tmessage: (value, label) => `Expected ${label!} to match \"^[\\\\p{L}\\\\p{N}_-]+$\", got ${value} instead`,\n\t\tvalidator: (value) => /^[\\p{L}\\p{N}_-]+$/u.test(value),\n\t});\n\nexport function validateName(name: unknown): asserts name is string {\n\tow(name, 'name', namePredicate);\n}\n\nconst descriptionPredicate = ow.string.minLength(1).maxLength(100);\n\nexport function validateDescription(description: unknown): asserts description is string {\n\tow(description, 'description', descriptionPredicate);\n}\n\nconst maxArrayLengthPredicate = ow.array.maxLength(25);\n\nexport function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[] {\n\tow(options, 'options', maxArrayLengthPredicate);\n}\n\nexport function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]) {\n\tow(choices, 'choices', maxArrayLengthPredicate);\n}\n\nexport function assertReturnOfBuilder<\n\tT extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder,\n>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T {\n\tconst instanceName = ExpectedInstanceOf.name;\n\n\tif (is.nullOrUndefined(input)) {\n\t\tthrow new TypeError(\n\t\t\t`Expected to receive a ${instanceName} builder, got ${input === null ? 'null' : 'undefined'} instead.`,\n\t\t);\n\t}\n\n\tif (is.primitive(input)) {\n\t\tthrow new TypeError(`Expected to receive a ${instanceName} builder, got a primitive (${typeof input}) instead.`);\n\t}\n\n\tif (!(input instanceof ExpectedInstanceOf)) {\n\t\tconst casted = input as Record<PropertyKey, unknown>;\n\n\t\tconst constructorName = is.function_(input) ? input.name : casted.constructor.name;\n\t\tconst stringTag = Reflect.get(casted, Symbol.toStringTag) as string | undefined;\n\n\t\tconst fullResultName = stringTag ? `${constructorName} [${stringTag}]` : constructorName;\n\n\t\tthrow new TypeError(`Expected to receive a ${instanceName} builder, got ${fullResultName} instead.`);\n\t}\n}\n"]}
\ No newline at end of file
import type { APIApplicationCommandOption } from 'discord-api-types/v9';
import { SharedNameAndDescription } from './mixins/NameAndDescription';
import { SharedSlashCommandOptions } from './mixins/CommandOptions';
import { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
export declare class SlashCommandBuilder {
/**
* The name of this slash command
*/
readonly name: string;
/**
* The description of this slash command
*/
readonly description: string;
/**
* The options of this slash command
*/
readonly options: ToAPIApplicationCommandOptions[];
/**
* Returns the final data that should be sent to Discord.
*
* **Note:** Calling this function will validate required properties based on their conditions.
*/
toJSON(): {
name: string;
description: string;
options: APIApplicationCommandOption[];
};
/**
* Adds a new subcommand group to this command
* @param input A function that returns a subcommand group builder, or an already built builder
*/
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandGroupsOnlyBuilder;
/**
* Adds a new subcommand to this command
* @param input A function that returns a subcommand builder, or an already built builder
*/
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
}
export interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {
}
export interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, Pick<SlashCommandBuilder, 'toJSON' | 'addSubcommand'> {
}
export interface SlashCommandSubcommandGroupsOnlyBuilder extends SharedNameAndDescription, Pick<SlashCommandBuilder, 'toJSON' | 'addSubcommandGroup'> {
}
export interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
}
export interface ToAPIApplicationCommandOptions {
toJSON(): APIApplicationCommandOption;
}
//# sourceMappingURL=SlashCommandBuilder.d.ts.map
\ No newline at end of file
{"version":3,"file":"SlashCommandBuilder.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAGxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAE9G,qBACa,mBAAmB;IAC/B;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAE/D;;;;OAIG;IACI,MAAM;;;;;IASb;;;OAGG;IACI,kBAAkB,CACxB,KAAK,EACF,kCAAkC,GAClC,CAAC,CAAC,eAAe,EAAE,kCAAkC,KAAK,kCAAkC,CAAC,GAC9F,uCAAuC;IAqB1C;;;OAGG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC,GACpF,kCAAkC;CAqBrC;AAED,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB,EAAE,yBAAyB;CAAG;AAEnG,MAAM,WAAW,kCAChB,SAAQ,wBAAwB,EAC/B,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,eAAe,CAAC;CAAG;AAE1D,MAAM,WAAW,uCAChB,SAAQ,wBAAwB,EAC/B,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,oBAAoB,CAAC;CAAG;AAE/D,MAAM,WAAW,8BAChB,SAAQ,wBAAwB,EAC/B,yBAAyB,EACzB,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC;CAAG;AAExC,MAAM,WAAW,8BAA8B;IAC9C,MAAM,IAAI,2BAA2B,CAAC;CACtC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SlashCommandBuilder = void 0;
const tslib_1 = require("tslib");
const ts_mixer_1 = require("ts-mixer");
const Assertions_1 = require("./Assertions");
const NameAndDescription_1 = require("./mixins/NameAndDescription");
const CommandOptions_1 = require("./mixins/CommandOptions");
const SlashCommandSubcommands_1 = require("./SlashCommandSubcommands");
let SlashCommandBuilder = class SlashCommandBuilder {
constructor() {
/**
* The name of this slash command
*/
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: undefined
});
/**
* The description of this slash command
*/
Object.defineProperty(this, "description", {
enumerable: true,
configurable: true,
writable: true,
value: undefined
});
/**
* The options of this slash command
*/
Object.defineProperty(this, "options", {
enumerable: true,
configurable: true,
writable: true,
value: []
});
}
/**
* Returns the final data that should be sent to Discord.
*
* **Note:** Calling this function will validate required properties based on their conditions.
*/
toJSON() {
Assertions_1.validateRequiredParameters(this.name, this.description, this.options);
return {
name: this.name,
description: this.description,
options: this.options.map((option) => option.toJSON()),
};
}
/**
* Adds a new subcommand group to this command
* @param input A function that returns a subcommand group builder, or an already built builder
*/
addSubcommandGroup(input) {
const { options } = this;
// First, assert options conditions - we cannot have more than 25 options
Assertions_1.validateMaxOptionsLength(options);
// Make sure there is no subcommand at the root level - if there is, throw
const hasSubcommands = options.some((item) => item instanceof SlashCommandSubcommands_1.SlashCommandSubcommandBuilder);
if (hasSubcommands)
throw new RangeError(`You cannot mix subcommands and subcommand groups at the root level.`);
// Get the final result
const result = typeof input === 'function' ? input(new SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder()) : input;
Assertions_1.assertReturnOfBuilder(result, SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder);
// Push it
options.push(result);
return this;
}
/**