diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..5e3ad27 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,264 @@ +{ + "name": "skopa", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@discordjs/builders": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.7.0.tgz", + "integrity": "sha512-GDtbKMkg433cOZur8Dv6c25EHxduNIBsxeHrsRoIM8+AwmEZ8r0tEpckx/sHwTLwQPOF3e2JWloZh9ofCaMfAw==", + "dependencies": { + "@discordjs/formatters": "^0.3.3", + "@discordjs/util": "^1.0.2", + "@sapphire/shapeshift": "^3.9.3", + "discord-api-types": "0.37.61", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.11.0" + } + }, + "node_modules/@discordjs/collection": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz", + "integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==", + "engines": { + "node": ">=16.11.0" + } + }, + "node_modules/@discordjs/formatters": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.3.3.tgz", + "integrity": "sha512-wTcI1Q5cps1eSGhl6+6AzzZkBBlVrBdc9IUhJbijRgVjCNIIIZPgqnUj3ntFODsHrdbGU8BEG9XmDQmgEEYn3w==", + "dependencies": { + "discord-api-types": "0.37.61" + }, + "engines": { + "node": ">=16.11.0" + } + }, + "node_modules/@discordjs/rest": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.2.0.tgz", + "integrity": "sha512-nXm9wT8oqrYFRMEqTXQx9DUTeEtXUDMmnUKIhZn6O2EeDY9VCdwj23XCPq7fkqMPKdF7ldAfeVKyxxFdbZl59A==", + "dependencies": { + "@discordjs/collection": "^2.0.0", + "@discordjs/util": "^1.0.2", + "@sapphire/async-queue": "^1.5.0", + "@sapphire/snowflake": "^3.5.1", + "@vladfrangu/async_event_emitter": "^2.2.2", + "discord-api-types": "0.37.61", + "magic-bytes.js": "^1.5.0", + "tslib": "^2.6.2", + "undici": "5.27.2" + }, + "engines": { + "node": ">=16.11.0" + } + }, + "node_modules/@discordjs/rest/node_modules/@discordjs/collection": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.0.0.tgz", + "integrity": "sha512-YTWIXLrf5FsrLMycpMM9Q6vnZoR/lN2AWX23/Cuo8uOOtS8eHB2dyQaaGnaF8aZPYnttf2bkLMcXn/j6JUOi3w==", + "engines": { + "node": ">=18" + } + }, + "node_modules/@discordjs/util": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.0.2.tgz", + "integrity": "sha512-IRNbimrmfb75GMNEjyznqM1tkI7HrZOf14njX7tCAAUetyZM1Pr8hX/EK2lxBCOgWDRmigbp24fD1hdMfQK5lw==", + "engines": { + "node": ">=16.11.0" + } + }, + "node_modules/@discordjs/ws": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.0.2.tgz", + "integrity": "sha512-+XI82Rm2hKnFwAySXEep4A7Kfoowt6weO6381jgW+wVdTpMS/56qCvoXyFRY0slcv7c/U8My2PwIB2/wEaAh7Q==", + "dependencies": { + "@discordjs/collection": "^2.0.0", + "@discordjs/rest": "^2.1.0", + "@discordjs/util": "^1.0.2", + "@sapphire/async-queue": "^1.5.0", + "@types/ws": "^8.5.9", + "@vladfrangu/async_event_emitter": "^2.2.2", + "discord-api-types": "0.37.61", + "tslib": "^2.6.2", + "ws": "^8.14.2" + }, + "engines": { + "node": ">=16.11.0" + } + }, + "node_modules/@discordjs/ws/node_modules/@discordjs/collection": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.0.0.tgz", + "integrity": "sha512-YTWIXLrf5FsrLMycpMM9Q6vnZoR/lN2AWX23/Cuo8uOOtS8eHB2dyQaaGnaF8aZPYnttf2bkLMcXn/j6JUOi3w==", + "engines": { + "node": ">=18" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", + "engines": { + "node": ">=14" + } + }, + "node_modules/@sapphire/async-queue": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.1.tgz", + "integrity": "sha512-1RdpsmDQR/aWfp8oJzPtn4dNQrbpqSL5PIA0uAB/XwerPXUf994Ug1au1e7uGcD7ei8/F63UDjr5GWps1g/HxQ==", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@sapphire/shapeshift": { + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.9.5.tgz", + "integrity": "sha512-AGdHe+51gF7D3W8hBfuSFLBocURDCXVQczScTHXDS3RpNjNgrktIx/amlz5y8nHhm8SAdFt/X8EF8ZSfjJ0tnA==", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=v18" + } + }, + "node_modules/@sapphire/snowflake": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.1.tgz", + "integrity": "sha512-BxcYGzgEsdlG0dKAyOm0ehLGm2CafIrfQTZGWgkfKYbj+pNNsorZ7EotuZukc2MT70E0UbppVbtpBrqpzVzjNA==", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/ws": { + "version": "8.5.9", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.9.tgz", + "integrity": "sha512-jbdrY0a8lxfdTp/+r7Z4CkycbOFN8WX+IOchLJr3juT/xzbJ8URyTVSJ/hvNdadTgM1mnedb47n+Y31GsFnQlg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@vladfrangu/async_event_emitter": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.4.tgz", + "integrity": "sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug==", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/discord-api-types": { + "version": "0.37.61", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.61.tgz", + "integrity": "sha512-o/dXNFfhBpYHpQFdT6FWzeO7pKc838QeeZ9d91CfVAtpr5XLK4B/zYxQbYgPdoMiTDvJfzcsLW5naXgmHGDNXw==" + }, + "node_modules/discord.js": { + "version": "14.14.1", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.14.1.tgz", + "integrity": "sha512-/hUVzkIerxKHyRKopJy5xejp4MYKDPTszAnpYxzVVv4qJYf+Tkt+jnT2N29PIPschicaEEpXwF2ARrTYHYwQ5w==", + "dependencies": { + "@discordjs/builders": "^1.7.0", + "@discordjs/collection": "1.5.3", + "@discordjs/formatters": "^0.3.3", + "@discordjs/rest": "^2.1.0", + "@discordjs/util": "^1.0.2", + "@discordjs/ws": "^1.0.2", + "@sapphire/snowflake": "3.5.1", + "@types/ws": "8.5.9", + "discord-api-types": "0.37.61", + "fast-deep-equal": "3.1.3", + "lodash.snakecase": "4.1.1", + "tslib": "2.6.2", + "undici": "5.27.2", + "ws": "8.14.2" + }, + "engines": { + "node": ">=16.11.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" + }, + "node_modules/magic-bytes.js": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.7.0.tgz", + "integrity": "sha512-YzVU2+/hrjwx8xcgAw+ffNq3jkactpj+f1iSL4LonrFKhvnwDzHSqtFdk/MMRP53y9ScouJ7cKEnqYsJwsHoYA==" + }, + "node_modules/ts-mixer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.3.tgz", + "integrity": "sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ==" + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/undici": { + "version": "5.27.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.27.2.tgz", + "integrity": "sha512-iS857PdOEy/y3wlM3yRp+6SNQQ6xU0mmZcwRSriqk+et/cwWAtwmIGf6WkoDN2EK/AMdCO/dfXzIwi+rFMrjjQ==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "node_modules/ws": { + "version": "8.14.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", + "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/node_modules/@discordjs/builders/LICENSE b/node_modules/@discordjs/builders/LICENSE new file mode 100644 index 0000000..cbe9c65 --- /dev/null +++ b/node_modules/@discordjs/builders/LICENSE @@ -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. diff --git a/node_modules/@discordjs/builders/README.md b/node_modules/@discordjs/builders/README.md new file mode 100644 index 0000000..dc88b7f --- /dev/null +++ b/node_modules/@discordjs/builders/README.md @@ -0,0 +1,72 @@ +
+
+

+ discord.js +

+
+

+ Discord server + npm version + npm downloads + Build status + Code coverage +

+

+ Vercel + Cloudflare Workers +

+
+ +## About + +`@discordjs/builders` is a utility package for easily building Discord API payloads. + +## Installation + +**Node.js 16.11.0 or newer is required.** + +```sh +npm install @discordjs/builders +yarn add @discordjs/builders +pnpm add @discordjs/builders +``` + +## Examples + +You can find examples of how to use the builders in the [Slash Command Builders][example] examples. + +## 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]. + +[example]: https://github.com/discordjs/discord.js/blob/main/packages/builders/docs/examples/Slash%20Command%20Builders.md +[website]: https://discord.js.org +[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website +[documentation]: https://discord.js.org/docs/packages/builders/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/builders +[npm]: https://www.npmjs.com/package/@discordjs/builders +[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries +[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md diff --git a/node_modules/@discordjs/builders/dist/index.d.mts b/node_modules/@discordjs/builders/dist/index.d.mts new file mode 100644 index 0000000..0280fc5 --- /dev/null +++ b/node_modules/@discordjs/builders/dist/index.d.mts @@ -0,0 +1,2008 @@ +import * as _sapphire_shapeshift from '@sapphire/shapeshift'; +import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, Snowflake, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, Permissions, RESTPostAPIChatInputApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10'; +export * from '@discordjs/formatters'; +import { JSONEncodable, Equatable } from '@discordjs/util'; + +declare const fieldNamePredicate: _sapphire_shapeshift.StringValidator; +declare const fieldValuePredicate: _sapphire_shapeshift.StringValidator; +declare const fieldInlinePredicate: _sapphire_shapeshift.UnionValidator; +declare const embedFieldPredicate: _sapphire_shapeshift.ObjectValidator<{ + name: string; + value: string; + inline: boolean | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + name: string; + value: string; + inline: boolean | undefined; +}>>; +declare const embedFieldsArrayPredicate: _sapphire_shapeshift.ArrayValidator<_sapphire_shapeshift.UndefinedToOptional<{ + name: string; + value: string; + inline: boolean | undefined; +}>[], _sapphire_shapeshift.UndefinedToOptional<{ + name: string; + value: string; + inline: boolean | undefined; +}>>; +declare const fieldLengthPredicate: _sapphire_shapeshift.NumberValidator; +declare function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void; +declare const authorNamePredicate: _sapphire_shapeshift.UnionValidator; +declare const imageURLPredicate: _sapphire_shapeshift.UnionValidator; +declare const urlPredicate: _sapphire_shapeshift.UnionValidator; +declare const embedAuthorPredicate: _sapphire_shapeshift.ObjectValidator<{ + name: string | null; + iconURL: string | null | undefined; + url: string | null | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + name: string | null; + iconURL: string | null | undefined; + url: string | null | undefined; +}>>; +declare const RGBPredicate: _sapphire_shapeshift.NumberValidator; +declare const colorPredicate: _sapphire_shapeshift.UnionValidator; +declare const descriptionPredicate: _sapphire_shapeshift.UnionValidator; +declare const footerTextPredicate: _sapphire_shapeshift.UnionValidator; +declare const embedFooterPredicate: _sapphire_shapeshift.ObjectValidator<{ + text: string | null; + iconURL: string | null | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + text: string | null; + iconURL: string | null | undefined; +}>>; +declare const timestampPredicate: _sapphire_shapeshift.UnionValidator; +declare const titlePredicate: _sapphire_shapeshift.UnionValidator; + +declare const Assertions$5_RGBPredicate: typeof RGBPredicate; +declare const Assertions$5_authorNamePredicate: typeof authorNamePredicate; +declare const Assertions$5_colorPredicate: typeof colorPredicate; +declare const Assertions$5_descriptionPredicate: typeof descriptionPredicate; +declare const Assertions$5_embedAuthorPredicate: typeof embedAuthorPredicate; +declare const Assertions$5_embedFieldPredicate: typeof embedFieldPredicate; +declare const Assertions$5_embedFieldsArrayPredicate: typeof embedFieldsArrayPredicate; +declare const Assertions$5_embedFooterPredicate: typeof embedFooterPredicate; +declare const Assertions$5_fieldInlinePredicate: typeof fieldInlinePredicate; +declare const Assertions$5_fieldLengthPredicate: typeof fieldLengthPredicate; +declare const Assertions$5_fieldNamePredicate: typeof fieldNamePredicate; +declare const Assertions$5_fieldValuePredicate: typeof fieldValuePredicate; +declare const Assertions$5_footerTextPredicate: typeof footerTextPredicate; +declare const Assertions$5_imageURLPredicate: typeof imageURLPredicate; +declare const Assertions$5_timestampPredicate: typeof timestampPredicate; +declare const Assertions$5_titlePredicate: typeof titlePredicate; +declare const Assertions$5_urlPredicate: typeof urlPredicate; +declare const Assertions$5_validateFieldLength: typeof validateFieldLength; +declare namespace Assertions$5 { + export { + Assertions$5_RGBPredicate as RGBPredicate, + Assertions$5_authorNamePredicate as authorNamePredicate, + Assertions$5_colorPredicate as colorPredicate, + Assertions$5_descriptionPredicate as descriptionPredicate, + Assertions$5_embedAuthorPredicate as embedAuthorPredicate, + Assertions$5_embedFieldPredicate as embedFieldPredicate, + Assertions$5_embedFieldsArrayPredicate as embedFieldsArrayPredicate, + Assertions$5_embedFooterPredicate as embedFooterPredicate, + Assertions$5_fieldInlinePredicate as fieldInlinePredicate, + Assertions$5_fieldLengthPredicate as fieldLengthPredicate, + Assertions$5_fieldNamePredicate as fieldNamePredicate, + Assertions$5_fieldValuePredicate as fieldValuePredicate, + Assertions$5_footerTextPredicate as footerTextPredicate, + Assertions$5_imageURLPredicate as imageURLPredicate, + Assertions$5_timestampPredicate as timestampPredicate, + Assertions$5_titlePredicate as titlePredicate, + Assertions$5_urlPredicate as urlPredicate, + Assertions$5_validateFieldLength as validateFieldLength, + }; +} + +/** + * Normalizes data that is a rest parameter or an array into an array with a depth of 1. + * + * @typeParam ItemType - The data that must satisfy {@link RestOrArray}. + * @param arr - The (possibly variadic) data to normalize + */ +declare function normalizeArray(arr: RestOrArray): ItemType[]; +/** + * Represents data that may be an array or came from a rest parameter. + * + * @remarks + * This type is used throughout builders to ensure both an array and variadic arguments + * may be used. It is normalized with {@link normalizeArray}. + */ +type RestOrArray = Type[] | [Type[]]; + +/** + * A tuple satisfying the RGB color model. + * + * @see {@link https://developer.mozilla.org/docs/Glossary/RGB} + */ +type RGBTuple = [red: number, green: number, blue: number]; +/** + * The base icon data typically used in payloads. + */ +interface IconData { + /** + * The URL of the icon. + */ + iconURL?: string; + /** + * The proxy URL of the icon. + */ + proxyIconURL?: string; +} +/** + * Represents the author data of an embed. + */ +type EmbedAuthorData = IconData & Omit; +/** + * Represents the author options of an embed. + */ +type EmbedAuthorOptions = Omit; +/** + * Represents the footer data of an embed. + */ +type EmbedFooterData = IconData & Omit; +/** + * Represents the footer options of an embed. + */ +type EmbedFooterOptions = Omit; +/** + * Represents the image data of an embed. + */ +interface EmbedImageData extends Omit { + /** + * The proxy URL for the image. + */ + proxyURL?: string; +} +/** + * A builder that creates API-compatible JSON data for embeds. + */ +declare class EmbedBuilder { + /** + * The API data associated with this embed. + */ + readonly data: APIEmbed; + /** + * Creates a new embed from API data. + * + * @param data - The API data to create this embed with + */ + constructor(data?: APIEmbed); + /** + * Appends fields to the embed. + * + * @remarks + * This method accepts either an array of fields or a variable number of field parameters. + * The maximum amount of fields that can be added is 25. + * @example + * Using an array: + * ```ts + * const fields: APIEmbedField[] = ...; + * const embed = new EmbedBuilder() + * .addFields(fields); + * ``` + * @example + * Using rest parameters (variadic): + * ```ts + * const embed = new EmbedBuilder() + * .addFields( + * { name: 'Field 1', value: 'Value 1' }, + * { name: 'Field 2', value: 'Value 2' }, + * ); + * ``` + * @param fields - The fields to add + */ + addFields(...fields: RestOrArray): this; + /** + * Removes, replaces, or inserts fields for this embed. + * + * @remarks + * This method behaves similarly + * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}. + * The maximum amount of fields that can be added is 25. + * + * It's useful for modifying and adjusting order of the already-existing fields of an embed. + * @example + * Remove the first field: + * ```ts + * embed.spliceFields(0, 1); + * ``` + * @example + * Remove the first n fields: + * ```ts + * const n = 4; + * embed.spliceFields(0, n); + * ``` + * @example + * Remove the last field: + * ```ts + * embed.spliceFields(-1, 1); + * ``` + * @param index - The index to start at + * @param deleteCount - The number of fields to remove + * @param fields - The replacing field objects + */ + spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this; + /** + * Sets the fields for this embed. + * + * @remarks + * This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically, + * it splices the entire array of fields, replacing them with the provided fields. + * + * You can set a maximum of 25 fields. + * @param fields - The fields to set + */ + setFields(...fields: RestOrArray): this; + /** + * Sets the author of this embed. + * + * @param options - The options to use + */ + setAuthor(options: EmbedAuthorOptions | null): this; + /** + * Sets the color of this embed. + * + * @param color - The color to use + */ + setColor(color: RGBTuple | number | null): this; + /** + * Sets the description of this embed. + * + * @param description - The description to use + */ + setDescription(description: string | null): this; + /** + * Sets the footer of this embed. + * + * @param options - The footer to use + */ + setFooter(options: EmbedFooterOptions | null): this; + /** + * Sets the image of this embed. + * + * @param url - The image URL to use + */ + setImage(url: string | null): this; + /** + * Sets the thumbnail of this embed. + * + * @param url - The thumbnail URL to use + */ + setThumbnail(url: string | null): this; + /** + * Sets the timestamp of this embed. + * + * @param timestamp - The timestamp or date to use + */ + setTimestamp(timestamp?: Date | number | null): this; + /** + * Sets the title for this embed. + * + * @param title - The title to use + */ + setTitle(title: string | null): this; + /** + * Sets the URL of this embed. + * + * @param url - The URL to use + */ + setURL(url: string | null): this; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): APIEmbed; +} + +/** + * A builder that creates API-compatible JSON data for string select menu options. + */ +declare class StringSelectMenuOptionBuilder implements JSONEncodable { + data: Partial; + /** + * Creates a new string select menu option from API data. + * + * @param data - The API data to create this string select menu option with + * @example + * Creating a string select menu option from an API data object: + * ```ts + * const selectMenuOption = new SelectMenuOptionBuilder({ + * label: 'catchy label', + * value: '1', + * }); + * ``` + * @example + * Creating a string select menu option using setters and API data: + * ```ts + * const selectMenuOption = new SelectMenuOptionBuilder({ + * default: true, + * value: '1', + * }) + * .setLabel('woah'); + * ``` + */ + constructor(data?: Partial); + /** + * Sets the label for this option. + * + * @param label - The label to use + */ + setLabel(label: string): this; + /** + * Sets the value for this option. + * + * @param value - The value to use + */ + setValue(value: string): this; + /** + * Sets the description for this option. + * + * @param description - The description to use + */ + setDescription(description: string): this; + /** + * Sets whether this option is selected by default. + * + * @param isDefault - Whether this option is selected by default + */ + setDefault(isDefault?: boolean): this; + /** + * Sets the emoji to display for this option. + * + * @param emoji - The emoji to use + */ + setEmoji(emoji: APIMessageComponentEmoji): this; + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON(): APISelectMenuOption; +} + +declare const customIdValidator: _sapphire_shapeshift.StringValidator; +declare const emojiValidator: _sapphire_shapeshift.ObjectValidator<{ + name?: string | undefined; + id?: string | undefined; + animated?: boolean | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + name?: string | undefined; + id?: string | undefined; + animated?: boolean | undefined; +}>>; +declare const disabledValidator: _sapphire_shapeshift.BooleanValidator; +declare const buttonLabelValidator: _sapphire_shapeshift.StringValidator; +declare const buttonStyleValidator: _sapphire_shapeshift.NativeEnumValidator; +declare const placeholderValidator$1: _sapphire_shapeshift.StringValidator; +declare const minMaxValidator: _sapphire_shapeshift.NumberValidator; +declare const labelValueDescriptionValidator: _sapphire_shapeshift.StringValidator; +declare const jsonOptionValidator: _sapphire_shapeshift.ObjectValidator<{ + label: string; + value: string; + description: string | undefined; + emoji: _sapphire_shapeshift.UndefinedToOptional<{ + name?: string | undefined; + id?: string | undefined; + animated?: boolean | undefined; + }> | undefined; + default: boolean | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + label: string; + value: string; + description: string | undefined; + emoji: _sapphire_shapeshift.UndefinedToOptional<{ + name?: string | undefined; + id?: string | undefined; + animated?: boolean | undefined; + }> | undefined; + default: boolean | undefined; +}>>; +declare const optionValidator: _sapphire_shapeshift.InstanceValidator; +declare const optionsValidator: _sapphire_shapeshift.ArrayValidator; +declare const optionsLengthValidator: _sapphire_shapeshift.NumberValidator; +declare function validateRequiredSelectMenuParameters(options: StringSelectMenuOptionBuilder[], customId?: string): void; +declare const defaultValidator: _sapphire_shapeshift.BooleanValidator; +declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void; +declare const channelTypesValidator: _sapphire_shapeshift.ArrayValidator; +declare const urlValidator: _sapphire_shapeshift.StringValidator; +declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void; + +declare const Assertions$4_buttonLabelValidator: typeof buttonLabelValidator; +declare const Assertions$4_buttonStyleValidator: typeof buttonStyleValidator; +declare const Assertions$4_channelTypesValidator: typeof channelTypesValidator; +declare const Assertions$4_customIdValidator: typeof customIdValidator; +declare const Assertions$4_defaultValidator: typeof defaultValidator; +declare const Assertions$4_disabledValidator: typeof disabledValidator; +declare const Assertions$4_emojiValidator: typeof emojiValidator; +declare const Assertions$4_jsonOptionValidator: typeof jsonOptionValidator; +declare const Assertions$4_labelValueDescriptionValidator: typeof labelValueDescriptionValidator; +declare const Assertions$4_minMaxValidator: typeof minMaxValidator; +declare const Assertions$4_optionValidator: typeof optionValidator; +declare const Assertions$4_optionsLengthValidator: typeof optionsLengthValidator; +declare const Assertions$4_optionsValidator: typeof optionsValidator; +declare const Assertions$4_urlValidator: typeof urlValidator; +declare const Assertions$4_validateRequiredButtonParameters: typeof validateRequiredButtonParameters; +declare const Assertions$4_validateRequiredSelectMenuOptionParameters: typeof validateRequiredSelectMenuOptionParameters; +declare const Assertions$4_validateRequiredSelectMenuParameters: typeof validateRequiredSelectMenuParameters; +declare namespace Assertions$4 { + export { + Assertions$4_buttonLabelValidator as buttonLabelValidator, + Assertions$4_buttonStyleValidator as buttonStyleValidator, + Assertions$4_channelTypesValidator as channelTypesValidator, + Assertions$4_customIdValidator as customIdValidator, + Assertions$4_defaultValidator as defaultValidator, + Assertions$4_disabledValidator as disabledValidator, + Assertions$4_emojiValidator as emojiValidator, + Assertions$4_jsonOptionValidator as jsonOptionValidator, + Assertions$4_labelValueDescriptionValidator as labelValueDescriptionValidator, + Assertions$4_minMaxValidator as minMaxValidator, + Assertions$4_optionValidator as optionValidator, + Assertions$4_optionsLengthValidator as optionsLengthValidator, + Assertions$4_optionsValidator as optionsValidator, + placeholderValidator$1 as placeholderValidator, + Assertions$4_urlValidator as urlValidator, + Assertions$4_validateRequiredButtonParameters as validateRequiredButtonParameters, + Assertions$4_validateRequiredSelectMenuOptionParameters as validateRequiredSelectMenuOptionParameters, + Assertions$4_validateRequiredSelectMenuParameters as validateRequiredSelectMenuParameters, + }; +} + +/** + * Any action row component data represented as an object. + */ +type AnyAPIActionRowComponent = APIActionRowComponent | APIActionRowComponentTypes; +/** + * The base component builder that contains common symbols for all sorts of components. + * + * @typeParam DataType - The type of internal API data that is stored within the component + */ +declare abstract class ComponentBuilder> = APIBaseComponent> implements JSONEncodable { + /** + * The API data associated with this component. + */ + readonly data: Partial; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + abstract toJSON(): AnyAPIActionRowComponent; + /** + * Constructs a new kind of component. + * + * @param data - The data to construct a component out of + */ + constructor(data: Partial); +} + +/** + * A builder that creates API-compatible JSON data for buttons. + */ +declare class ButtonBuilder extends ComponentBuilder { + /** + * Creates a new button from API data. + * + * @param data - The API data to create this button with + * @example + * Creating a button from an API data object: + * ```ts + * const button = new ButtonBuilder({ + * custom_id: 'a cool button', + * style: ButtonStyle.Primary, + * label: 'Click Me', + * emoji: { + * name: 'smile', + * id: '123456789012345678', + * }, + * }); + * ``` + * @example + * Creating a button using setters and API data: + * ```ts + * const button = new ButtonBuilder({ + * style: ButtonStyle.Secondary, + * label: 'Click Me', + * }) + * .setEmoji({ name: '🙂' }) + * .setCustomId('another cool button'); + * ``` + */ + constructor(data?: Partial); + /** + * Sets the style of this button. + * + * @param style - The style to use + */ + setStyle(style: ButtonStyle): this; + /** + * Sets the URL for this button. + * + * @remarks + * This method is only available to buttons using the `Link` button style. + * Only three types of URL schemes are currently supported: `https://`, `http://`, and `discord://`. + * @param url - The URL to use + */ + setURL(url: string): this; + /** + * Sets the custom id for this button. + * + * @remarks + * This method is only applicable to buttons that are not using the `Link` button style. + * @param customId - The custom id to use + */ + setCustomId(customId: string): this; + /** + * Sets the emoji to display on this button. + * + * @param emoji - The emoji to use + */ + setEmoji(emoji: APIMessageComponentEmoji): this; + /** + * Sets whether this button is disabled. + * + * @param disabled - Whether to disable this button + */ + setDisabled(disabled?: boolean): this; + /** + * Sets the label for this button. + * + * @param label - The label to use + */ + setLabel(label: string): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): APIButtonComponent; +} + +/** + * The base select menu builder that contains common symbols for select menu builders. + * + * @typeParam SelectMenuType - The type of select menu this would be instantiated for. + */ +declare abstract class BaseSelectMenuBuilder extends ComponentBuilder { + /** + * Sets the placeholder for this select menu. + * + * @param placeholder - The placeholder to use + */ + setPlaceholder(placeholder: string): this; + /** + * Sets the minimum values that must be selected in the select menu. + * + * @param minValues - The minimum values that must be selected + */ + setMinValues(minValues: number): this; + /** + * Sets the maximum values that must be selected in the select menu. + * + * @param maxValues - The maximum values that must be selected + */ + setMaxValues(maxValues: number): this; + /** + * Sets the custom id for this select menu. + * + * @param customId - The custom id to use + */ + setCustomId(customId: string): this; + /** + * Sets whether this select menu is disabled. + * + * @param disabled - Whether this select menu is disabled + */ + setDisabled(disabled?: boolean): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): SelectMenuType; +} + +/** + * A builder that creates API-compatible JSON data for channel select menus. + */ +declare class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new ChannelSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new ChannelSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + * .setMinValues(2); + * ``` + */ + constructor(data?: Partial); + /** + * Adds channel types to this select menu. + * + * @param types - The channel types to use + */ + addChannelTypes(...types: RestOrArray): this; + /** + * Sets channel types for this select menu. + * + * @param types - The channel types to use + */ + setChannelTypes(...types: RestOrArray): this; + /** + * Adds default channels to this auto populated select menu. + * + * @param channels - The channels to add + */ + addDefaultChannels(...channels: RestOrArray): this; + /** + * Sets default channels to this auto populated select menu. + * + * @param channels - The channels to set + */ + setDefaultChannels(...channels: RestOrArray): this; + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON(): APIChannelSelectComponent; +} + +/** + * A builder that creates API-compatible JSON data for mentionable select menus. + */ +declare class MentionableSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new MentionableSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new MentionableSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data?: Partial); + /** + * Adds default roles to this auto populated select menu. + * + * @param roles - The roles to add + */ + addDefaultRoles(...roles: RestOrArray): this; + /** + * Adds default users to this auto populated select menu. + * + * @param users - The users to add + */ + addDefaultUsers(...users: RestOrArray): this; + /** + * Adds default values to this auto populated select menu. + * + * @param values - The values to add + */ + addDefaultValues(...values: RestOrArray | APISelectMenuDefaultValue>): this; + /** + * Sets default values to this auto populated select menu. + * + * @param values - The values to set + */ + setDefaultValues(...values: RestOrArray | APISelectMenuDefaultValue>): this; +} + +/** + * A builder that creates API-compatible JSON data for role select menus. + */ +declare class RoleSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new RoleSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new RoleSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data?: Partial); + /** + * Adds default roles to this auto populated select menu. + * + * @param roles - The roles to add + */ + addDefaultRoles(...roles: RestOrArray): this; + /** + * Sets default roles to this auto populated select menu. + * + * @param roles - The roles to set + */ + setDefaultRoles(...roles: RestOrArray): this; +} + +/** + * A builder that creates API-compatible JSON data for string select menus. + */ +declare class StringSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * The options within this select menu. + */ + readonly options: StringSelectMenuOptionBuilder[]; + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new StringSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * options: [ + * { label: 'option 1', value: '1' }, + * { label: 'option 2', value: '2' }, + * { label: 'option 3', value: '3' }, + * ], + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new StringSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1) + * .addOptions({ + * label: 'Catchy', + * value: 'catch', + * }); + * ``` + */ + constructor(data?: Partial); + /** + * Adds options to this select menu. + * + * @param options - The options to add + */ + addOptions(...options: RestOrArray): this; + /** + * Sets the options for this select menu. + * + * @param options - The options to set + */ + setOptions(...options: RestOrArray): this; + /** + * Removes, replaces, or inserts options for this select menu. + * + * @remarks + * This method behaves similarly + * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice()}. + * It's useful for modifying and adjusting the order of existing options. + * @example + * Remove the first option: + * ```ts + * selectMenu.spliceOptions(0, 1); + * ``` + * @example + * Remove the first n option: + * ```ts + * const n = 4; + * selectMenu.spliceOptions(0, n); + * ``` + * @example + * Remove the last option: + * ```ts + * selectMenu.spliceOptions(-1, 1); + * ``` + * @param index - The index to start at + * @param deleteCount - The number of options to remove + * @param options - The replacing option objects or builders + */ + spliceOptions(index: number, deleteCount: number, ...options: RestOrArray): this; + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON(): APIStringSelectComponent; +} + +/** + * A builder that creates API-compatible JSON data for user select menus. + */ +declare class UserSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new UserSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new UserSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data?: Partial); + /** + * Adds default users to this auto populated select menu. + * + * @param users - The users to add + */ + addDefaultUsers(...users: RestOrArray): this; + /** + * Sets default users to this auto populated select menu. + * + * @param users - The users to set + */ + setDefaultUsers(...users: RestOrArray): this; +} + +/** + * A builder that creates API-compatible JSON data for text inputs. + */ +declare class TextInputBuilder extends ComponentBuilder implements Equatable> { + /** + * Creates a new text input from API data. + * + * @param data - The API data to create this text input with + * @example + * Creating a select menu option from an API data object: + * ```ts + * const textInput = new TextInputBuilder({ + * custom_id: 'a cool select menu', + * label: 'Type something', + * style: TextInputStyle.Short, + * }); + * ``` + * @example + * Creating a select menu option using setters and API data: + * ```ts + * const textInput = new TextInputBuilder({ + * label: 'Type something else', + * }) + * .setCustomId('woah') + * .setStyle(TextInputStyle.Paragraph); + * ``` + */ + constructor(data?: APITextInputComponent & { + type?: ComponentType.TextInput; + }); + /** + * Sets the custom id for this text input. + * + * @param customId - The custom id to use + */ + setCustomId(customId: string): this; + /** + * Sets the label for this text input. + * + * @param label - The label to use + */ + setLabel(label: string): this; + /** + * Sets the style for this text input. + * + * @param style - The style to use + */ + setStyle(style: TextInputStyle): this; + /** + * Sets the minimum length of text for this text input. + * + * @param minLength - The minimum length of text for this text input + */ + setMinLength(minLength: number): this; + /** + * Sets the maximum length of text for this text input. + * + * @param maxLength - The maximum length of text for this text input + */ + setMaxLength(maxLength: number): this; + /** + * Sets the placeholder for this text input. + * + * @param placeholder - The placeholder to use + */ + setPlaceholder(placeholder: string): this; + /** + * Sets the value for this text input. + * + * @param value - The value to use + */ + setValue(value: string): this; + /** + * Sets whether this text input is required. + * + * @param required - Whether this text input is required + */ + setRequired(required?: boolean): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): APITextInputComponent; + /** + * {@inheritDoc Equatable.equals} + */ + equals(other: APITextInputComponent | JSONEncodable): boolean; +} + +/** + * The builders that may be used for messages. + */ +type MessageComponentBuilder = ActionRowBuilder | MessageActionRowComponentBuilder; +/** + * The builders that may be used for modals. + */ +type ModalComponentBuilder = ActionRowBuilder | ModalActionRowComponentBuilder; +/** + * The builders that may be used within an action row for messages. + */ +type MessageActionRowComponentBuilder = ButtonBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder | RoleSelectMenuBuilder | StringSelectMenuBuilder | UserSelectMenuBuilder; +/** + * The builders that may be used within an action row for modals. + */ +type ModalActionRowComponentBuilder = TextInputBuilder; +/** + * Any builder. + */ +type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder; +/** + * A builder that creates API-compatible JSON data for action rows. + * + * @typeParam ComponentType - The types of components this action row holds + */ +declare class ActionRowBuilder extends ComponentBuilder> { + /** + * The components within this action row. + */ + readonly components: ComponentType[]; + /** + * Creates a new action row from API data. + * + * @param data - The API data to create this action row with + * @example + * Creating an action row from an API data object: + * ```ts + * const actionRow = new ActionRowBuilder({ + * components: [ + * { + * custom_id: "custom id", + * label: "Type something", + * style: TextInputStyle.Short, + * type: ComponentType.TextInput, + * }, + * ], + * }); + * ``` + * @example + * Creating an action row using setters and API data: + * ```ts + * const actionRow = new ActionRowBuilder({ + * components: [ + * { + * custom_id: "custom id", + * label: "Click me", + * style: ButtonStyle.Primary, + * type: ComponentType.Button, + * }, + * ], + * }) + * .addComponents(button2, button3); + * ``` + */ + constructor({ components, ...data }?: Partial>); + /** + * Adds components to this action row. + * + * @param components - The components to add + */ + addComponents(...components: RestOrArray): this; + /** + * Sets components for this action row. + * + * @param components - The components to set + */ + setComponents(...components: RestOrArray): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): APIActionRowComponent>; +} + +/** + * Components here are mapped to their respective builder. + */ +interface MappedComponentTypes { + /** + * The action row component type is associated with an {@link ActionRowBuilder}. + */ + [ComponentType.ActionRow]: ActionRowBuilder; + /** + * The button component type is associated with an {@link ButtonBuilder}. + */ + [ComponentType.Button]: ButtonBuilder; + /** + * The string select component type is associated with an {@link StringSelectMenuBuilder}. + */ + [ComponentType.StringSelect]: StringSelectMenuBuilder; + /** + * The text inpiut component type is associated with an {@link TextInputBuilder}. + */ + [ComponentType.TextInput]: TextInputBuilder; + /** + * The user select component type is associated with an {@link UserSelectMenuBuilder}. + */ + [ComponentType.UserSelect]: UserSelectMenuBuilder; + /** + * The role select component type is associated with an {@link RoleSelectMenuBuilder}. + */ + [ComponentType.RoleSelect]: RoleSelectMenuBuilder; + /** + * The mentionable select component type is associated with an {@link MentionableSelectMenuBuilder}. + */ + [ComponentType.MentionableSelect]: MentionableSelectMenuBuilder; + /** + * The channel select component type is associated with an {@link ChannelSelectMenuBuilder}. + */ + [ComponentType.ChannelSelect]: ChannelSelectMenuBuilder; +} +/** + * Factory for creating components from API data. + * + * @typeParam ComponentType - The type of component to use + * @param data - The API data to transform to a component class + */ +declare function createComponentBuilder(data: (APIModalComponent | APIMessageComponent) & { + type: ComponentType; +}): MappedComponentTypes[ComponentType]; +/** + * Factory for creating components from API data. + * + * @typeParam ComponentBuilder - The type of component to use + * @param data - The API data to transform to a component class + */ +declare function createComponentBuilder(data: ComponentBuilder): ComponentBuilder; + +declare const textInputStyleValidator: _sapphire_shapeshift.NativeEnumValidator; +declare const minLengthValidator: _sapphire_shapeshift.NumberValidator; +declare const maxLengthValidator: _sapphire_shapeshift.NumberValidator; +declare const requiredValidator: _sapphire_shapeshift.BooleanValidator; +declare const valueValidator: _sapphire_shapeshift.StringValidator; +declare const placeholderValidator: _sapphire_shapeshift.StringValidator; +declare const labelValidator: _sapphire_shapeshift.StringValidator; +declare function validateRequiredParameters$3(customId?: string, style?: TextInputStyle, label?: string): void; + +declare const Assertions$3_labelValidator: typeof labelValidator; +declare const Assertions$3_maxLengthValidator: typeof maxLengthValidator; +declare const Assertions$3_minLengthValidator: typeof minLengthValidator; +declare const Assertions$3_placeholderValidator: typeof placeholderValidator; +declare const Assertions$3_requiredValidator: typeof requiredValidator; +declare const Assertions$3_textInputStyleValidator: typeof textInputStyleValidator; +declare const Assertions$3_valueValidator: typeof valueValidator; +declare namespace Assertions$3 { + export { + Assertions$3_labelValidator as labelValidator, + Assertions$3_maxLengthValidator as maxLengthValidator, + Assertions$3_minLengthValidator as minLengthValidator, + Assertions$3_placeholderValidator as placeholderValidator, + Assertions$3_requiredValidator as requiredValidator, + Assertions$3_textInputStyleValidator as textInputStyleValidator, + validateRequiredParameters$3 as validateRequiredParameters, + Assertions$3_valueValidator as valueValidator, + }; +} + +/** + * A builder that creates API-compatible JSON data for modals. + */ +declare class ModalBuilder implements JSONEncodable { + /** + * The API data associated with this modal. + */ + readonly data: Partial; + /** + * The components within this modal. + */ + readonly components: ActionRowBuilder[]; + /** + * Creates a new modal from API data. + * + * @param data - The API data to create this modal with + */ + constructor({ components, ...data }?: Partial); + /** + * Sets the title of this modal. + * + * @param title - The title to use + */ + setTitle(title: string): this; + /** + * Sets the custom id of this modal. + * + * @param customId - The custom id to use + */ + setCustomId(customId: string): this; + /** + * Adds components to this modal. + * + * @param components - The components to add + */ + addComponents(...components: RestOrArray | APIActionRowComponent>): this; + /** + * Sets components for this modal. + * + * @param components - The components to set + */ + setComponents(...components: RestOrArray>): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): APIModalInteractionResponseCallbackData; +} + +declare const titleValidator: _sapphire_shapeshift.StringValidator; +declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[ActionRowBuilder, ...ActionRowBuilder[]], ActionRowBuilder>; +declare function validateRequiredParameters$2(customId?: string, title?: string, components?: ActionRowBuilder[]): void; + +declare const Assertions$2_componentsValidator: typeof componentsValidator; +declare const Assertions$2_titleValidator: typeof titleValidator; +declare namespace Assertions$2 { + export { + Assertions$2_componentsValidator as componentsValidator, + Assertions$2_titleValidator as titleValidator, + validateRequiredParameters$2 as validateRequiredParameters, + }; +} + +/** + * This mixin holds name and description symbols for slash commands. + */ +declare class SharedNameAndDescription { + /** + * The name of this command. + */ + readonly name: string; + /** + * The name localizations of this command. + */ + readonly name_localizations?: LocalizationMap; + /** + * The description of this command. + */ + readonly description: string; + /** + * The description localizations of this command. + */ + readonly description_localizations?: LocalizationMap; + /** + * Sets the name of this command. + * + * @param name - The name to use + */ + setName(name: string): this; + /** + * Sets the description of this command. + * + * @param description - The description to use + */ + setDescription(description: string): this; + /** + * Sets a name localization for this command. + * + * @param locale - The locale to set + * @param localizedName - The localized name for the given `locale` + */ + setNameLocalization(locale: LocaleString, localizedName: string | null): this; + /** + * Sets the name localizations for this command. + * + * @param localizedNames - The object of localized names to set + */ + setNameLocalizations(localizedNames: LocalizationMap | null): this; + /** + * Sets a description localization for this command. + * + * @param locale - The locale to set + * @param localizedDescription - The localized description for the given locale + */ + setDescriptionLocalization(locale: LocaleString, localizedDescription: string | null): this; + /** + * Sets the description localizations for this command. + * + * @param localizedDescriptions - The object of localized descriptions to set + */ + setDescriptionLocalizations(localizedDescriptions: LocalizationMap | null): this; +} + +/** + * The base application command option builder that contains common symbols for application command builders. + */ +declare abstract class ApplicationCommandOptionBase extends SharedNameAndDescription { + /** + * The type of this option. + */ + abstract readonly type: ApplicationCommandOptionType; + /** + * Whether this option is required. + * + * @defaultValue `false` + */ + readonly required: boolean; + /** + * Sets whether this option is required. + * + * @param required - Whether this option should be required + */ + setRequired(required: boolean): this; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + abstract toJSON(): APIApplicationCommandBasicOption; + /** + * This method runs required validators on this builder. + */ + protected runRequiredValidations(): void; +} + +/** + * A slash command attachment option. + */ +declare class SlashCommandAttachmentOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Attachment; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandAttachmentOption; +} + +/** + * A slash command boolean option. + */ +declare class SlashCommandBooleanOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Boolean; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandBooleanOption; +} + +/** + * The allowed channel types used for a channel option in a slash command builder. + * + * @privateRemarks This can't be dynamic because const enums are erased at runtime. + * @internal + */ +declare const allowedChannelTypes: readonly [ChannelType.GuildText, ChannelType.GuildVoice, ChannelType.GuildCategory, ChannelType.GuildAnnouncement, ChannelType.AnnouncementThread, ChannelType.PublicThread, ChannelType.PrivateThread, ChannelType.GuildStageVoice, ChannelType.GuildForum, ChannelType.GuildMedia]; +/** + * The type of allowed channel types used for a channel option. + */ +type ApplicationCommandOptionAllowedChannelTypes = (typeof allowedChannelTypes)[number]; +/** + * This mixin holds channel type symbols used for options. + */ +declare class ApplicationCommandOptionChannelTypesMixin { + /** + * The channel types of this option. + */ + readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[]; + /** + * Adds channel types to this option. + * + * @param channelTypes - The channel types + */ + addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]): this; +} + +/** + * A slash command channel option. + */ +declare class SlashCommandChannelOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Channel; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandChannelOption; +} +interface SlashCommandChannelOption extends ApplicationCommandOptionChannelTypesMixin { +} + +/** + * This mixin holds minimum and maximum symbols used for options. + */ +declare abstract class ApplicationCommandNumericOptionMinMaxValueMixin { + /** + * The maximum value of this option. + */ + readonly max_value?: number; + /** + * The minimum value of this option. + */ + readonly min_value?: number; + /** + * Sets the maximum number value of this option. + * + * @param max - The maximum value this option can be + */ + abstract setMaxValue(max: number): this; + /** + * Sets the minimum number value of this option. + * + * @param min - The minimum value this option can be + */ + abstract setMinValue(min: number): this; +} + +/** + * This mixin holds choices and autocomplete symbols used for options. + */ +declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin { + /** + * The choices of this option. + */ + readonly choices?: APIApplicationCommandOptionChoice[]; + /** + * Whether this option utilizes autocomplete. + */ + readonly autocomplete?: boolean; + /** + * The type of this option. + * + * @privateRemarks Since this is present and this is a mixin, this is needed. + */ + readonly type: ApplicationCommandOptionType; + /** + * Adds multiple choices to this option. + * + * @param choices - The choices to add + */ + addChoices(...choices: APIApplicationCommandOptionChoice[]): this; + /** + * Sets multiple choices for this option. + * + * @param choices - The choices to set + */ + setChoices[]>(...choices: Input): this; + /** + * Whether this option uses autocomplete. + * + * @param autocomplete - Whether this option should use autocomplete + */ + setAutocomplete(autocomplete: boolean): this; +} + +/** + * A slash command integer option. + */ +declare class SlashCommandIntegerOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Integer; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue} + */ + setMaxValue(max: number): this; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue} + */ + setMinValue(min: number): this; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandIntegerOption; +} +interface SlashCommandIntegerOption extends ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin { +} + +/** + * A slash command mentionable option. + */ +declare class SlashCommandMentionableOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Mentionable; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandMentionableOption; +} + +/** + * A slash command number option. + */ +declare class SlashCommandNumberOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Number; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue} + */ + setMaxValue(max: number): this; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue} + */ + setMinValue(min: number): this; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandNumberOption; +} +interface SlashCommandNumberOption extends ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin { +} + +/** + * A slash command role option. + */ +declare class SlashCommandRoleOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Role; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandRoleOption; +} + +/** + * A slash command string option. + */ +declare class SlashCommandStringOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.String; + /** + * The maximum length of this option. + */ + readonly max_length?: number; + /** + * The minimum length of this option. + */ + readonly min_length?: number; + /** + * Sets the maximum length of this string option. + * + * @param max - The maximum length this option can be + */ + setMaxLength(max: number): this; + /** + * Sets the minimum length of this string option. + * + * @param min - The minimum length this option can be + */ + setMinLength(min: number): this; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandStringOption; +} +interface SlashCommandStringOption extends ApplicationCommandOptionWithChoicesAndAutocompleteMixin { +} + +/** + * A slash command user option. + */ +declare class SlashCommandUserOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.User; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandUserOption; +} + +/** + * This mixin holds symbols that can be shared in slash command options. + * + * @typeParam ShouldOmitSubcommandFunctions - Whether to omit subcommand functions. + */ +declare class SharedSlashCommandOptions { + readonly options: ToAPIApplicationCommandOptions[]; + /** + * Adds a boolean option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a user option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a channel option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a role option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds an attachment option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addAttachmentOption(input: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a mentionable option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addMentionableOption(input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a string option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addStringOption(input: Omit | Omit | SlashCommandStringOption | ((builder: SlashCommandStringOption) => Omit | Omit | SlashCommandStringOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds an integer option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addIntegerOption(input: Omit | Omit | SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => Omit | Omit | SlashCommandIntegerOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a number option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addNumberOption(input: Omit | Omit | SlashCommandNumberOption | ((builder: SlashCommandNumberOption) => Omit | Omit | SlashCommandNumberOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Where the actual adding magic happens. ✨ + * + * @param input - The input. What else? + * @param Instance - The instance of whatever is being added + * @internal + */ + private _sharedAddOptionMethod; +} + +/** + * Represents a folder for subcommands. + * + * @see {@link https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups} + */ +declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions { + /** + * The name of this subcommand group. + */ + readonly name: string; + /** + * The description of this subcommand group. + */ + readonly description: string; + /** + * The subcommands within this subcommand group. + */ + readonly options: SlashCommandSubcommandBuilder[]; + /** + * Adds a new subcommand to this group. + * + * @param input - A function that returns a subcommand builder or an already built builder + */ + addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): APIApplicationCommandSubcommandGroupOption; +} +interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription { +} +/** + * A builder that creates API-compatible JSON data for slash command subcommands. + * + * @see {@link https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups} + */ +declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions { + /** + * The name of this subcommand. + */ + readonly name: string; + /** + * The description of this subcommand. + */ + readonly description: string; + /** + * The options within this subcommand. + */ + readonly options: ApplicationCommandOptionBase[]; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): APIApplicationCommandSubcommandOption; +} +interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions { +} + +/** + * A builder that creates API-compatible JSON data for slash commands. + */ +declare class SlashCommandBuilder { + /** + * The name of this command. + */ + readonly name: string; + /** + * The name localizations of this command. + */ + readonly name_localizations?: LocalizationMap; + /** + * The description of this command. + */ + readonly description: string; + /** + * The description localizations of this command. + */ + readonly description_localizations?: LocalizationMap; + /** + * The options of this command. + */ + readonly options: ToAPIApplicationCommandOptions[]; + /** + * Whether this command is enabled by default when the application is added to a guild. + * + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + readonly default_permission: boolean | undefined; + /** + * The set of permissions represented as a bit set for the command. + */ + readonly default_member_permissions: Permissions | null | undefined; + /** + * Indicates whether the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This property is only for global commands. + */ + readonly dm_permission: boolean | undefined; + /** + * Whether this command is NSFW. + */ + readonly nsfw: boolean | undefined; + /** + * Sets whether the command is enabled by default when the application is added to a guild. + * + * @remarks + * If set to `false`, you will have to later `PUT` the permissions for this command. + * @param value - Whether or not to enable this command by default + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + * @deprecated Use {@link SlashCommandBuilder.setDefaultMemberPermissions} or {@link SlashCommandBuilder.setDMPermission} instead. + */ + setDefaultPermission(value: boolean): this; + /** + * Sets the default permissions a member should have in order to run the command. + * + * @remarks + * You can set this to `'0'` to disable the command by default. + * @param permissions - The permissions bit field to set + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined): this; + /** + * Sets if the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This method is only for global commands. + * @param enabled - Whether the command should be enabled in direct messages + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDMPermission(enabled: boolean | null | undefined): this; + /** + * Sets whether this command is NSFW. + * + * @param nsfw - Whether this command is NSFW + */ + setNSFW(nsfw?: boolean): this; + /** + * 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)): SlashCommandSubcommandsOnlyBuilder; + /** + * 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; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): RESTPostAPIChatInputApplicationCommandsJSONBody; +} +interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions { +} +/** + * An interface specifically for slash command subcommands. + */ +interface SlashCommandSubcommandsOnlyBuilder extends Omit> { +} +/** + * An interface specifically for slash command options. + */ +interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick { +} +/** + * An interface that ensures the `toJSON()` call will return something + * that can be serialized into API-compatible data. + */ +interface ToAPIApplicationCommandOptions { + toJSON(): APIApplicationCommandOption; +} + +declare function validateName$1(name: unknown): asserts name is string; +declare function validateDescription(description: unknown): asserts description is string; +declare function validateLocale(locale: unknown): Locale; +declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[]; +declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void; +declare function validateDefaultPermission$1(value: unknown): asserts value is boolean; +declare function validateRequired(required: unknown): asserts required is boolean; +declare function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void; +declare function assertReturnOfBuilder(input: unknown, ExpectedInstanceOf: new () => ReturnType): asserts input is ReturnType; +declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<_sapphire_shapeshift.UndefinedToOptional>> | null | undefined>; +declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap; +declare function validateDMPermission$1(value: unknown): asserts value is boolean | null | undefined; +declare function validateDefaultMemberPermissions$1(permissions: unknown): string | null | undefined; +declare function validateNSFW(value: unknown): asserts value is boolean; + +declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder; +declare const Assertions$1_localizationMapPredicate: typeof localizationMapPredicate; +declare const Assertions$1_validateChoicesLength: typeof validateChoicesLength; +declare const Assertions$1_validateDescription: typeof validateDescription; +declare const Assertions$1_validateLocale: typeof validateLocale; +declare const Assertions$1_validateLocalizationMap: typeof validateLocalizationMap; +declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLength; +declare const Assertions$1_validateNSFW: typeof validateNSFW; +declare const Assertions$1_validateRequired: typeof validateRequired; +declare namespace Assertions$1 { + export { + Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder, + Assertions$1_localizationMapPredicate as localizationMapPredicate, + Assertions$1_validateChoicesLength as validateChoicesLength, + validateDMPermission$1 as validateDMPermission, + validateDefaultMemberPermissions$1 as validateDefaultMemberPermissions, + validateDefaultPermission$1 as validateDefaultPermission, + Assertions$1_validateDescription as validateDescription, + Assertions$1_validateLocale as validateLocale, + Assertions$1_validateLocalizationMap as validateLocalizationMap, + Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength, + Assertions$1_validateNSFW as validateNSFW, + validateName$1 as validateName, + Assertions$1_validateRequired as validateRequired, + validateRequiredParameters$1 as validateRequiredParameters, + }; +} + +/** + * The type a context menu command can be. + */ +type ContextMenuCommandType = ApplicationCommandType.Message | ApplicationCommandType.User; +/** + * A builder that creates API-compatible JSON data for context menu commands. + */ +declare class ContextMenuCommandBuilder { + /** + * The name of this command. + */ + readonly name: string; + /** + * The name localizations of this command. + */ + readonly name_localizations?: LocalizationMap; + /** + * The type of this command. + */ + readonly type: ContextMenuCommandType; + /** + * Whether this command is enabled by default when the application is added to a guild. + * + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + readonly default_permission: boolean | undefined; + /** + * The set of permissions represented as a bit set for the command. + */ + readonly default_member_permissions: Permissions | null | undefined; + /** + * Indicates whether the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This property is only for global commands. + */ + readonly dm_permission: boolean | undefined; + /** + * Sets the name of this command. + * + * @param name - The name to use + */ + setName(name: string): this; + /** + * Sets the type of this command. + * + * @param type - The type to use + */ + setType(type: ContextMenuCommandType): this; + /** + * Sets whether the command is enabled by default when the application is added to a guild. + * + * @remarks + * If set to `false`, you will have to later `PUT` the permissions for this command. + * @param value - Whether to enable this command by default + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + setDefaultPermission(value: boolean): this; + /** + * Sets the default permissions a member should have in order to run this command. + * + * @remarks + * You can set this to `'0'` to disable the command by default. + * @param permissions - The permissions bit field to set + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined): this; + /** + * Sets if the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This method is only for global commands. + * @param enabled - Whether the command should be enabled in direct messages + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDMPermission(enabled: boolean | null | undefined): this; + /** + * Sets a name localization for this command. + * + * @param locale - The locale to set + * @param localizedName - The localized name for the given `locale` + */ + setNameLocalization(locale: LocaleString, localizedName: string | null): this; + /** + * Sets the name localizations for this command. + * + * @param localizedNames - The object of localized names to set + */ + setNameLocalizations(localizedNames: LocalizationMap | null): this; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): RESTPostAPIContextMenuApplicationCommandsJSONBody; +} + +declare function validateDefaultPermission(value: unknown): asserts value is boolean; +declare function validateName(name: unknown): asserts name is string; +declare function validateType(type: unknown): asserts type is ContextMenuCommandType; +declare function validateRequiredParameters(name: string, type: number): void; +declare function validateDMPermission(value: unknown): asserts value is boolean | null | undefined; +declare function validateDefaultMemberPermissions(permissions: unknown): string | null | undefined; + +declare const Assertions_validateDMPermission: typeof validateDMPermission; +declare const Assertions_validateDefaultMemberPermissions: typeof validateDefaultMemberPermissions; +declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission; +declare const Assertions_validateName: typeof validateName; +declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters; +declare const Assertions_validateType: typeof validateType; +declare namespace Assertions { + export { + Assertions_validateDMPermission as validateDMPermission, + Assertions_validateDefaultMemberPermissions as validateDefaultMemberPermissions, + Assertions_validateDefaultPermission as validateDefaultPermission, + Assertions_validateName as validateName, + Assertions_validateRequiredParameters as validateRequiredParameters, + Assertions_validateType as validateType, + }; +} + +/** + * Calculates the length of the embed. + * + * @param data - The embed data to check + */ +declare function embedLength(data: APIEmbed): number; + +/** + * Enables validators. + * + * @returns Whether validation is occurring. + */ +declare function enableValidators(): boolean; +/** + * Disables validators. + * + * @returns Whether validation is occurring. + */ +declare function disableValidators(): boolean; +/** + * Checks whether validation is occurring. + */ +declare function isValidationEnabled(): boolean; + +/** + * The {@link https://github.com/discordjs/discord.js/blob/main/packages/builders#readme | @discordjs/builders} 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 { ActionRowBuilder, AnyAPIActionRowComponent, AnyComponentBuilder, ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, ApplicationCommandOptionChannelTypesMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin, BaseSelectMenuBuilder, ButtonBuilder, ChannelSelectMenuBuilder, Assertions$4 as ComponentAssertions, ComponentBuilder, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Assertions$5 as EmbedAssertions, EmbedAuthorData, EmbedAuthorOptions, EmbedBuilder, EmbedFooterData, EmbedFooterOptions, EmbedImageData, IconData, MappedComponentTypes, MentionableSelectMenuBuilder, MessageActionRowComponentBuilder, MessageComponentBuilder, ModalActionRowComponentBuilder, Assertions$2 as ModalAssertions, ModalBuilder, ModalComponentBuilder, RGBTuple, RestOrArray, RoleSelectMenuBuilder, StringSelectMenuBuilder as SelectMenuBuilder, StringSelectMenuOptionBuilder as SelectMenuOptionBuilder, SharedNameAndDescription, SharedSlashCommandOptions, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, Assertions$3 as TextInputAssertions, TextInputBuilder, ToAPIApplicationCommandOptions, UserSelectMenuBuilder, createComponentBuilder, disableValidators, embedLength, enableValidators, isValidationEnabled, normalizeArray, version }; diff --git a/node_modules/@discordjs/builders/dist/index.d.ts b/node_modules/@discordjs/builders/dist/index.d.ts new file mode 100644 index 0000000..0280fc5 --- /dev/null +++ b/node_modules/@discordjs/builders/dist/index.d.ts @@ -0,0 +1,2008 @@ +import * as _sapphire_shapeshift from '@sapphire/shapeshift'; +import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, Snowflake, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, Permissions, RESTPostAPIChatInputApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10'; +export * from '@discordjs/formatters'; +import { JSONEncodable, Equatable } from '@discordjs/util'; + +declare const fieldNamePredicate: _sapphire_shapeshift.StringValidator; +declare const fieldValuePredicate: _sapphire_shapeshift.StringValidator; +declare const fieldInlinePredicate: _sapphire_shapeshift.UnionValidator; +declare const embedFieldPredicate: _sapphire_shapeshift.ObjectValidator<{ + name: string; + value: string; + inline: boolean | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + name: string; + value: string; + inline: boolean | undefined; +}>>; +declare const embedFieldsArrayPredicate: _sapphire_shapeshift.ArrayValidator<_sapphire_shapeshift.UndefinedToOptional<{ + name: string; + value: string; + inline: boolean | undefined; +}>[], _sapphire_shapeshift.UndefinedToOptional<{ + name: string; + value: string; + inline: boolean | undefined; +}>>; +declare const fieldLengthPredicate: _sapphire_shapeshift.NumberValidator; +declare function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void; +declare const authorNamePredicate: _sapphire_shapeshift.UnionValidator; +declare const imageURLPredicate: _sapphire_shapeshift.UnionValidator; +declare const urlPredicate: _sapphire_shapeshift.UnionValidator; +declare const embedAuthorPredicate: _sapphire_shapeshift.ObjectValidator<{ + name: string | null; + iconURL: string | null | undefined; + url: string | null | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + name: string | null; + iconURL: string | null | undefined; + url: string | null | undefined; +}>>; +declare const RGBPredicate: _sapphire_shapeshift.NumberValidator; +declare const colorPredicate: _sapphire_shapeshift.UnionValidator; +declare const descriptionPredicate: _sapphire_shapeshift.UnionValidator; +declare const footerTextPredicate: _sapphire_shapeshift.UnionValidator; +declare const embedFooterPredicate: _sapphire_shapeshift.ObjectValidator<{ + text: string | null; + iconURL: string | null | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + text: string | null; + iconURL: string | null | undefined; +}>>; +declare const timestampPredicate: _sapphire_shapeshift.UnionValidator; +declare const titlePredicate: _sapphire_shapeshift.UnionValidator; + +declare const Assertions$5_RGBPredicate: typeof RGBPredicate; +declare const Assertions$5_authorNamePredicate: typeof authorNamePredicate; +declare const Assertions$5_colorPredicate: typeof colorPredicate; +declare const Assertions$5_descriptionPredicate: typeof descriptionPredicate; +declare const Assertions$5_embedAuthorPredicate: typeof embedAuthorPredicate; +declare const Assertions$5_embedFieldPredicate: typeof embedFieldPredicate; +declare const Assertions$5_embedFieldsArrayPredicate: typeof embedFieldsArrayPredicate; +declare const Assertions$5_embedFooterPredicate: typeof embedFooterPredicate; +declare const Assertions$5_fieldInlinePredicate: typeof fieldInlinePredicate; +declare const Assertions$5_fieldLengthPredicate: typeof fieldLengthPredicate; +declare const Assertions$5_fieldNamePredicate: typeof fieldNamePredicate; +declare const Assertions$5_fieldValuePredicate: typeof fieldValuePredicate; +declare const Assertions$5_footerTextPredicate: typeof footerTextPredicate; +declare const Assertions$5_imageURLPredicate: typeof imageURLPredicate; +declare const Assertions$5_timestampPredicate: typeof timestampPredicate; +declare const Assertions$5_titlePredicate: typeof titlePredicate; +declare const Assertions$5_urlPredicate: typeof urlPredicate; +declare const Assertions$5_validateFieldLength: typeof validateFieldLength; +declare namespace Assertions$5 { + export { + Assertions$5_RGBPredicate as RGBPredicate, + Assertions$5_authorNamePredicate as authorNamePredicate, + Assertions$5_colorPredicate as colorPredicate, + Assertions$5_descriptionPredicate as descriptionPredicate, + Assertions$5_embedAuthorPredicate as embedAuthorPredicate, + Assertions$5_embedFieldPredicate as embedFieldPredicate, + Assertions$5_embedFieldsArrayPredicate as embedFieldsArrayPredicate, + Assertions$5_embedFooterPredicate as embedFooterPredicate, + Assertions$5_fieldInlinePredicate as fieldInlinePredicate, + Assertions$5_fieldLengthPredicate as fieldLengthPredicate, + Assertions$5_fieldNamePredicate as fieldNamePredicate, + Assertions$5_fieldValuePredicate as fieldValuePredicate, + Assertions$5_footerTextPredicate as footerTextPredicate, + Assertions$5_imageURLPredicate as imageURLPredicate, + Assertions$5_timestampPredicate as timestampPredicate, + Assertions$5_titlePredicate as titlePredicate, + Assertions$5_urlPredicate as urlPredicate, + Assertions$5_validateFieldLength as validateFieldLength, + }; +} + +/** + * Normalizes data that is a rest parameter or an array into an array with a depth of 1. + * + * @typeParam ItemType - The data that must satisfy {@link RestOrArray}. + * @param arr - The (possibly variadic) data to normalize + */ +declare function normalizeArray(arr: RestOrArray): ItemType[]; +/** + * Represents data that may be an array or came from a rest parameter. + * + * @remarks + * This type is used throughout builders to ensure both an array and variadic arguments + * may be used. It is normalized with {@link normalizeArray}. + */ +type RestOrArray = Type[] | [Type[]]; + +/** + * A tuple satisfying the RGB color model. + * + * @see {@link https://developer.mozilla.org/docs/Glossary/RGB} + */ +type RGBTuple = [red: number, green: number, blue: number]; +/** + * The base icon data typically used in payloads. + */ +interface IconData { + /** + * The URL of the icon. + */ + iconURL?: string; + /** + * The proxy URL of the icon. + */ + proxyIconURL?: string; +} +/** + * Represents the author data of an embed. + */ +type EmbedAuthorData = IconData & Omit; +/** + * Represents the author options of an embed. + */ +type EmbedAuthorOptions = Omit; +/** + * Represents the footer data of an embed. + */ +type EmbedFooterData = IconData & Omit; +/** + * Represents the footer options of an embed. + */ +type EmbedFooterOptions = Omit; +/** + * Represents the image data of an embed. + */ +interface EmbedImageData extends Omit { + /** + * The proxy URL for the image. + */ + proxyURL?: string; +} +/** + * A builder that creates API-compatible JSON data for embeds. + */ +declare class EmbedBuilder { + /** + * The API data associated with this embed. + */ + readonly data: APIEmbed; + /** + * Creates a new embed from API data. + * + * @param data - The API data to create this embed with + */ + constructor(data?: APIEmbed); + /** + * Appends fields to the embed. + * + * @remarks + * This method accepts either an array of fields or a variable number of field parameters. + * The maximum amount of fields that can be added is 25. + * @example + * Using an array: + * ```ts + * const fields: APIEmbedField[] = ...; + * const embed = new EmbedBuilder() + * .addFields(fields); + * ``` + * @example + * Using rest parameters (variadic): + * ```ts + * const embed = new EmbedBuilder() + * .addFields( + * { name: 'Field 1', value: 'Value 1' }, + * { name: 'Field 2', value: 'Value 2' }, + * ); + * ``` + * @param fields - The fields to add + */ + addFields(...fields: RestOrArray): this; + /** + * Removes, replaces, or inserts fields for this embed. + * + * @remarks + * This method behaves similarly + * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}. + * The maximum amount of fields that can be added is 25. + * + * It's useful for modifying and adjusting order of the already-existing fields of an embed. + * @example + * Remove the first field: + * ```ts + * embed.spliceFields(0, 1); + * ``` + * @example + * Remove the first n fields: + * ```ts + * const n = 4; + * embed.spliceFields(0, n); + * ``` + * @example + * Remove the last field: + * ```ts + * embed.spliceFields(-1, 1); + * ``` + * @param index - The index to start at + * @param deleteCount - The number of fields to remove + * @param fields - The replacing field objects + */ + spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this; + /** + * Sets the fields for this embed. + * + * @remarks + * This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically, + * it splices the entire array of fields, replacing them with the provided fields. + * + * You can set a maximum of 25 fields. + * @param fields - The fields to set + */ + setFields(...fields: RestOrArray): this; + /** + * Sets the author of this embed. + * + * @param options - The options to use + */ + setAuthor(options: EmbedAuthorOptions | null): this; + /** + * Sets the color of this embed. + * + * @param color - The color to use + */ + setColor(color: RGBTuple | number | null): this; + /** + * Sets the description of this embed. + * + * @param description - The description to use + */ + setDescription(description: string | null): this; + /** + * Sets the footer of this embed. + * + * @param options - The footer to use + */ + setFooter(options: EmbedFooterOptions | null): this; + /** + * Sets the image of this embed. + * + * @param url - The image URL to use + */ + setImage(url: string | null): this; + /** + * Sets the thumbnail of this embed. + * + * @param url - The thumbnail URL to use + */ + setThumbnail(url: string | null): this; + /** + * Sets the timestamp of this embed. + * + * @param timestamp - The timestamp or date to use + */ + setTimestamp(timestamp?: Date | number | null): this; + /** + * Sets the title for this embed. + * + * @param title - The title to use + */ + setTitle(title: string | null): this; + /** + * Sets the URL of this embed. + * + * @param url - The URL to use + */ + setURL(url: string | null): this; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): APIEmbed; +} + +/** + * A builder that creates API-compatible JSON data for string select menu options. + */ +declare class StringSelectMenuOptionBuilder implements JSONEncodable { + data: Partial; + /** + * Creates a new string select menu option from API data. + * + * @param data - The API data to create this string select menu option with + * @example + * Creating a string select menu option from an API data object: + * ```ts + * const selectMenuOption = new SelectMenuOptionBuilder({ + * label: 'catchy label', + * value: '1', + * }); + * ``` + * @example + * Creating a string select menu option using setters and API data: + * ```ts + * const selectMenuOption = new SelectMenuOptionBuilder({ + * default: true, + * value: '1', + * }) + * .setLabel('woah'); + * ``` + */ + constructor(data?: Partial); + /** + * Sets the label for this option. + * + * @param label - The label to use + */ + setLabel(label: string): this; + /** + * Sets the value for this option. + * + * @param value - The value to use + */ + setValue(value: string): this; + /** + * Sets the description for this option. + * + * @param description - The description to use + */ + setDescription(description: string): this; + /** + * Sets whether this option is selected by default. + * + * @param isDefault - Whether this option is selected by default + */ + setDefault(isDefault?: boolean): this; + /** + * Sets the emoji to display for this option. + * + * @param emoji - The emoji to use + */ + setEmoji(emoji: APIMessageComponentEmoji): this; + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON(): APISelectMenuOption; +} + +declare const customIdValidator: _sapphire_shapeshift.StringValidator; +declare const emojiValidator: _sapphire_shapeshift.ObjectValidator<{ + name?: string | undefined; + id?: string | undefined; + animated?: boolean | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + name?: string | undefined; + id?: string | undefined; + animated?: boolean | undefined; +}>>; +declare const disabledValidator: _sapphire_shapeshift.BooleanValidator; +declare const buttonLabelValidator: _sapphire_shapeshift.StringValidator; +declare const buttonStyleValidator: _sapphire_shapeshift.NativeEnumValidator; +declare const placeholderValidator$1: _sapphire_shapeshift.StringValidator; +declare const minMaxValidator: _sapphire_shapeshift.NumberValidator; +declare const labelValueDescriptionValidator: _sapphire_shapeshift.StringValidator; +declare const jsonOptionValidator: _sapphire_shapeshift.ObjectValidator<{ + label: string; + value: string; + description: string | undefined; + emoji: _sapphire_shapeshift.UndefinedToOptional<{ + name?: string | undefined; + id?: string | undefined; + animated?: boolean | undefined; + }> | undefined; + default: boolean | undefined; +}, _sapphire_shapeshift.UndefinedToOptional<{ + label: string; + value: string; + description: string | undefined; + emoji: _sapphire_shapeshift.UndefinedToOptional<{ + name?: string | undefined; + id?: string | undefined; + animated?: boolean | undefined; + }> | undefined; + default: boolean | undefined; +}>>; +declare const optionValidator: _sapphire_shapeshift.InstanceValidator; +declare const optionsValidator: _sapphire_shapeshift.ArrayValidator; +declare const optionsLengthValidator: _sapphire_shapeshift.NumberValidator; +declare function validateRequiredSelectMenuParameters(options: StringSelectMenuOptionBuilder[], customId?: string): void; +declare const defaultValidator: _sapphire_shapeshift.BooleanValidator; +declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void; +declare const channelTypesValidator: _sapphire_shapeshift.ArrayValidator; +declare const urlValidator: _sapphire_shapeshift.StringValidator; +declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void; + +declare const Assertions$4_buttonLabelValidator: typeof buttonLabelValidator; +declare const Assertions$4_buttonStyleValidator: typeof buttonStyleValidator; +declare const Assertions$4_channelTypesValidator: typeof channelTypesValidator; +declare const Assertions$4_customIdValidator: typeof customIdValidator; +declare const Assertions$4_defaultValidator: typeof defaultValidator; +declare const Assertions$4_disabledValidator: typeof disabledValidator; +declare const Assertions$4_emojiValidator: typeof emojiValidator; +declare const Assertions$4_jsonOptionValidator: typeof jsonOptionValidator; +declare const Assertions$4_labelValueDescriptionValidator: typeof labelValueDescriptionValidator; +declare const Assertions$4_minMaxValidator: typeof minMaxValidator; +declare const Assertions$4_optionValidator: typeof optionValidator; +declare const Assertions$4_optionsLengthValidator: typeof optionsLengthValidator; +declare const Assertions$4_optionsValidator: typeof optionsValidator; +declare const Assertions$4_urlValidator: typeof urlValidator; +declare const Assertions$4_validateRequiredButtonParameters: typeof validateRequiredButtonParameters; +declare const Assertions$4_validateRequiredSelectMenuOptionParameters: typeof validateRequiredSelectMenuOptionParameters; +declare const Assertions$4_validateRequiredSelectMenuParameters: typeof validateRequiredSelectMenuParameters; +declare namespace Assertions$4 { + export { + Assertions$4_buttonLabelValidator as buttonLabelValidator, + Assertions$4_buttonStyleValidator as buttonStyleValidator, + Assertions$4_channelTypesValidator as channelTypesValidator, + Assertions$4_customIdValidator as customIdValidator, + Assertions$4_defaultValidator as defaultValidator, + Assertions$4_disabledValidator as disabledValidator, + Assertions$4_emojiValidator as emojiValidator, + Assertions$4_jsonOptionValidator as jsonOptionValidator, + Assertions$4_labelValueDescriptionValidator as labelValueDescriptionValidator, + Assertions$4_minMaxValidator as minMaxValidator, + Assertions$4_optionValidator as optionValidator, + Assertions$4_optionsLengthValidator as optionsLengthValidator, + Assertions$4_optionsValidator as optionsValidator, + placeholderValidator$1 as placeholderValidator, + Assertions$4_urlValidator as urlValidator, + Assertions$4_validateRequiredButtonParameters as validateRequiredButtonParameters, + Assertions$4_validateRequiredSelectMenuOptionParameters as validateRequiredSelectMenuOptionParameters, + Assertions$4_validateRequiredSelectMenuParameters as validateRequiredSelectMenuParameters, + }; +} + +/** + * Any action row component data represented as an object. + */ +type AnyAPIActionRowComponent = APIActionRowComponent | APIActionRowComponentTypes; +/** + * The base component builder that contains common symbols for all sorts of components. + * + * @typeParam DataType - The type of internal API data that is stored within the component + */ +declare abstract class ComponentBuilder> = APIBaseComponent> implements JSONEncodable { + /** + * The API data associated with this component. + */ + readonly data: Partial; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + abstract toJSON(): AnyAPIActionRowComponent; + /** + * Constructs a new kind of component. + * + * @param data - The data to construct a component out of + */ + constructor(data: Partial); +} + +/** + * A builder that creates API-compatible JSON data for buttons. + */ +declare class ButtonBuilder extends ComponentBuilder { + /** + * Creates a new button from API data. + * + * @param data - The API data to create this button with + * @example + * Creating a button from an API data object: + * ```ts + * const button = new ButtonBuilder({ + * custom_id: 'a cool button', + * style: ButtonStyle.Primary, + * label: 'Click Me', + * emoji: { + * name: 'smile', + * id: '123456789012345678', + * }, + * }); + * ``` + * @example + * Creating a button using setters and API data: + * ```ts + * const button = new ButtonBuilder({ + * style: ButtonStyle.Secondary, + * label: 'Click Me', + * }) + * .setEmoji({ name: '🙂' }) + * .setCustomId('another cool button'); + * ``` + */ + constructor(data?: Partial); + /** + * Sets the style of this button. + * + * @param style - The style to use + */ + setStyle(style: ButtonStyle): this; + /** + * Sets the URL for this button. + * + * @remarks + * This method is only available to buttons using the `Link` button style. + * Only three types of URL schemes are currently supported: `https://`, `http://`, and `discord://`. + * @param url - The URL to use + */ + setURL(url: string): this; + /** + * Sets the custom id for this button. + * + * @remarks + * This method is only applicable to buttons that are not using the `Link` button style. + * @param customId - The custom id to use + */ + setCustomId(customId: string): this; + /** + * Sets the emoji to display on this button. + * + * @param emoji - The emoji to use + */ + setEmoji(emoji: APIMessageComponentEmoji): this; + /** + * Sets whether this button is disabled. + * + * @param disabled - Whether to disable this button + */ + setDisabled(disabled?: boolean): this; + /** + * Sets the label for this button. + * + * @param label - The label to use + */ + setLabel(label: string): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): APIButtonComponent; +} + +/** + * The base select menu builder that contains common symbols for select menu builders. + * + * @typeParam SelectMenuType - The type of select menu this would be instantiated for. + */ +declare abstract class BaseSelectMenuBuilder extends ComponentBuilder { + /** + * Sets the placeholder for this select menu. + * + * @param placeholder - The placeholder to use + */ + setPlaceholder(placeholder: string): this; + /** + * Sets the minimum values that must be selected in the select menu. + * + * @param minValues - The minimum values that must be selected + */ + setMinValues(minValues: number): this; + /** + * Sets the maximum values that must be selected in the select menu. + * + * @param maxValues - The maximum values that must be selected + */ + setMaxValues(maxValues: number): this; + /** + * Sets the custom id for this select menu. + * + * @param customId - The custom id to use + */ + setCustomId(customId: string): this; + /** + * Sets whether this select menu is disabled. + * + * @param disabled - Whether this select menu is disabled + */ + setDisabled(disabled?: boolean): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): SelectMenuType; +} + +/** + * A builder that creates API-compatible JSON data for channel select menus. + */ +declare class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new ChannelSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new ChannelSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + * .setMinValues(2); + * ``` + */ + constructor(data?: Partial); + /** + * Adds channel types to this select menu. + * + * @param types - The channel types to use + */ + addChannelTypes(...types: RestOrArray): this; + /** + * Sets channel types for this select menu. + * + * @param types - The channel types to use + */ + setChannelTypes(...types: RestOrArray): this; + /** + * Adds default channels to this auto populated select menu. + * + * @param channels - The channels to add + */ + addDefaultChannels(...channels: RestOrArray): this; + /** + * Sets default channels to this auto populated select menu. + * + * @param channels - The channels to set + */ + setDefaultChannels(...channels: RestOrArray): this; + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON(): APIChannelSelectComponent; +} + +/** + * A builder that creates API-compatible JSON data for mentionable select menus. + */ +declare class MentionableSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new MentionableSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new MentionableSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data?: Partial); + /** + * Adds default roles to this auto populated select menu. + * + * @param roles - The roles to add + */ + addDefaultRoles(...roles: RestOrArray): this; + /** + * Adds default users to this auto populated select menu. + * + * @param users - The users to add + */ + addDefaultUsers(...users: RestOrArray): this; + /** + * Adds default values to this auto populated select menu. + * + * @param values - The values to add + */ + addDefaultValues(...values: RestOrArray | APISelectMenuDefaultValue>): this; + /** + * Sets default values to this auto populated select menu. + * + * @param values - The values to set + */ + setDefaultValues(...values: RestOrArray | APISelectMenuDefaultValue>): this; +} + +/** + * A builder that creates API-compatible JSON data for role select menus. + */ +declare class RoleSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new RoleSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new RoleSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data?: Partial); + /** + * Adds default roles to this auto populated select menu. + * + * @param roles - The roles to add + */ + addDefaultRoles(...roles: RestOrArray): this; + /** + * Sets default roles to this auto populated select menu. + * + * @param roles - The roles to set + */ + setDefaultRoles(...roles: RestOrArray): this; +} + +/** + * A builder that creates API-compatible JSON data for string select menus. + */ +declare class StringSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * The options within this select menu. + */ + readonly options: StringSelectMenuOptionBuilder[]; + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new StringSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * options: [ + * { label: 'option 1', value: '1' }, + * { label: 'option 2', value: '2' }, + * { label: 'option 3', value: '3' }, + * ], + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new StringSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1) + * .addOptions({ + * label: 'Catchy', + * value: 'catch', + * }); + * ``` + */ + constructor(data?: Partial); + /** + * Adds options to this select menu. + * + * @param options - The options to add + */ + addOptions(...options: RestOrArray): this; + /** + * Sets the options for this select menu. + * + * @param options - The options to set + */ + setOptions(...options: RestOrArray): this; + /** + * Removes, replaces, or inserts options for this select menu. + * + * @remarks + * This method behaves similarly + * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice()}. + * It's useful for modifying and adjusting the order of existing options. + * @example + * Remove the first option: + * ```ts + * selectMenu.spliceOptions(0, 1); + * ``` + * @example + * Remove the first n option: + * ```ts + * const n = 4; + * selectMenu.spliceOptions(0, n); + * ``` + * @example + * Remove the last option: + * ```ts + * selectMenu.spliceOptions(-1, 1); + * ``` + * @param index - The index to start at + * @param deleteCount - The number of options to remove + * @param options - The replacing option objects or builders + */ + spliceOptions(index: number, deleteCount: number, ...options: RestOrArray): this; + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON(): APIStringSelectComponent; +} + +/** + * A builder that creates API-compatible JSON data for user select menus. + */ +declare class UserSelectMenuBuilder extends BaseSelectMenuBuilder { + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new UserSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new UserSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data?: Partial); + /** + * Adds default users to this auto populated select menu. + * + * @param users - The users to add + */ + addDefaultUsers(...users: RestOrArray): this; + /** + * Sets default users to this auto populated select menu. + * + * @param users - The users to set + */ + setDefaultUsers(...users: RestOrArray): this; +} + +/** + * A builder that creates API-compatible JSON data for text inputs. + */ +declare class TextInputBuilder extends ComponentBuilder implements Equatable> { + /** + * Creates a new text input from API data. + * + * @param data - The API data to create this text input with + * @example + * Creating a select menu option from an API data object: + * ```ts + * const textInput = new TextInputBuilder({ + * custom_id: 'a cool select menu', + * label: 'Type something', + * style: TextInputStyle.Short, + * }); + * ``` + * @example + * Creating a select menu option using setters and API data: + * ```ts + * const textInput = new TextInputBuilder({ + * label: 'Type something else', + * }) + * .setCustomId('woah') + * .setStyle(TextInputStyle.Paragraph); + * ``` + */ + constructor(data?: APITextInputComponent & { + type?: ComponentType.TextInput; + }); + /** + * Sets the custom id for this text input. + * + * @param customId - The custom id to use + */ + setCustomId(customId: string): this; + /** + * Sets the label for this text input. + * + * @param label - The label to use + */ + setLabel(label: string): this; + /** + * Sets the style for this text input. + * + * @param style - The style to use + */ + setStyle(style: TextInputStyle): this; + /** + * Sets the minimum length of text for this text input. + * + * @param minLength - The minimum length of text for this text input + */ + setMinLength(minLength: number): this; + /** + * Sets the maximum length of text for this text input. + * + * @param maxLength - The maximum length of text for this text input + */ + setMaxLength(maxLength: number): this; + /** + * Sets the placeholder for this text input. + * + * @param placeholder - The placeholder to use + */ + setPlaceholder(placeholder: string): this; + /** + * Sets the value for this text input. + * + * @param value - The value to use + */ + setValue(value: string): this; + /** + * Sets whether this text input is required. + * + * @param required - Whether this text input is required + */ + setRequired(required?: boolean): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): APITextInputComponent; + /** + * {@inheritDoc Equatable.equals} + */ + equals(other: APITextInputComponent | JSONEncodable): boolean; +} + +/** + * The builders that may be used for messages. + */ +type MessageComponentBuilder = ActionRowBuilder | MessageActionRowComponentBuilder; +/** + * The builders that may be used for modals. + */ +type ModalComponentBuilder = ActionRowBuilder | ModalActionRowComponentBuilder; +/** + * The builders that may be used within an action row for messages. + */ +type MessageActionRowComponentBuilder = ButtonBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder | RoleSelectMenuBuilder | StringSelectMenuBuilder | UserSelectMenuBuilder; +/** + * The builders that may be used within an action row for modals. + */ +type ModalActionRowComponentBuilder = TextInputBuilder; +/** + * Any builder. + */ +type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder; +/** + * A builder that creates API-compatible JSON data for action rows. + * + * @typeParam ComponentType - The types of components this action row holds + */ +declare class ActionRowBuilder extends ComponentBuilder> { + /** + * The components within this action row. + */ + readonly components: ComponentType[]; + /** + * Creates a new action row from API data. + * + * @param data - The API data to create this action row with + * @example + * Creating an action row from an API data object: + * ```ts + * const actionRow = new ActionRowBuilder({ + * components: [ + * { + * custom_id: "custom id", + * label: "Type something", + * style: TextInputStyle.Short, + * type: ComponentType.TextInput, + * }, + * ], + * }); + * ``` + * @example + * Creating an action row using setters and API data: + * ```ts + * const actionRow = new ActionRowBuilder({ + * components: [ + * { + * custom_id: "custom id", + * label: "Click me", + * style: ButtonStyle.Primary, + * type: ComponentType.Button, + * }, + * ], + * }) + * .addComponents(button2, button3); + * ``` + */ + constructor({ components, ...data }?: Partial>); + /** + * Adds components to this action row. + * + * @param components - The components to add + */ + addComponents(...components: RestOrArray): this; + /** + * Sets components for this action row. + * + * @param components - The components to set + */ + setComponents(...components: RestOrArray): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): APIActionRowComponent>; +} + +/** + * Components here are mapped to their respective builder. + */ +interface MappedComponentTypes { + /** + * The action row component type is associated with an {@link ActionRowBuilder}. + */ + [ComponentType.ActionRow]: ActionRowBuilder; + /** + * The button component type is associated with an {@link ButtonBuilder}. + */ + [ComponentType.Button]: ButtonBuilder; + /** + * The string select component type is associated with an {@link StringSelectMenuBuilder}. + */ + [ComponentType.StringSelect]: StringSelectMenuBuilder; + /** + * The text inpiut component type is associated with an {@link TextInputBuilder}. + */ + [ComponentType.TextInput]: TextInputBuilder; + /** + * The user select component type is associated with an {@link UserSelectMenuBuilder}. + */ + [ComponentType.UserSelect]: UserSelectMenuBuilder; + /** + * The role select component type is associated with an {@link RoleSelectMenuBuilder}. + */ + [ComponentType.RoleSelect]: RoleSelectMenuBuilder; + /** + * The mentionable select component type is associated with an {@link MentionableSelectMenuBuilder}. + */ + [ComponentType.MentionableSelect]: MentionableSelectMenuBuilder; + /** + * The channel select component type is associated with an {@link ChannelSelectMenuBuilder}. + */ + [ComponentType.ChannelSelect]: ChannelSelectMenuBuilder; +} +/** + * Factory for creating components from API data. + * + * @typeParam ComponentType - The type of component to use + * @param data - The API data to transform to a component class + */ +declare function createComponentBuilder(data: (APIModalComponent | APIMessageComponent) & { + type: ComponentType; +}): MappedComponentTypes[ComponentType]; +/** + * Factory for creating components from API data. + * + * @typeParam ComponentBuilder - The type of component to use + * @param data - The API data to transform to a component class + */ +declare function createComponentBuilder(data: ComponentBuilder): ComponentBuilder; + +declare const textInputStyleValidator: _sapphire_shapeshift.NativeEnumValidator; +declare const minLengthValidator: _sapphire_shapeshift.NumberValidator; +declare const maxLengthValidator: _sapphire_shapeshift.NumberValidator; +declare const requiredValidator: _sapphire_shapeshift.BooleanValidator; +declare const valueValidator: _sapphire_shapeshift.StringValidator; +declare const placeholderValidator: _sapphire_shapeshift.StringValidator; +declare const labelValidator: _sapphire_shapeshift.StringValidator; +declare function validateRequiredParameters$3(customId?: string, style?: TextInputStyle, label?: string): void; + +declare const Assertions$3_labelValidator: typeof labelValidator; +declare const Assertions$3_maxLengthValidator: typeof maxLengthValidator; +declare const Assertions$3_minLengthValidator: typeof minLengthValidator; +declare const Assertions$3_placeholderValidator: typeof placeholderValidator; +declare const Assertions$3_requiredValidator: typeof requiredValidator; +declare const Assertions$3_textInputStyleValidator: typeof textInputStyleValidator; +declare const Assertions$3_valueValidator: typeof valueValidator; +declare namespace Assertions$3 { + export { + Assertions$3_labelValidator as labelValidator, + Assertions$3_maxLengthValidator as maxLengthValidator, + Assertions$3_minLengthValidator as minLengthValidator, + Assertions$3_placeholderValidator as placeholderValidator, + Assertions$3_requiredValidator as requiredValidator, + Assertions$3_textInputStyleValidator as textInputStyleValidator, + validateRequiredParameters$3 as validateRequiredParameters, + Assertions$3_valueValidator as valueValidator, + }; +} + +/** + * A builder that creates API-compatible JSON data for modals. + */ +declare class ModalBuilder implements JSONEncodable { + /** + * The API data associated with this modal. + */ + readonly data: Partial; + /** + * The components within this modal. + */ + readonly components: ActionRowBuilder[]; + /** + * Creates a new modal from API data. + * + * @param data - The API data to create this modal with + */ + constructor({ components, ...data }?: Partial); + /** + * Sets the title of this modal. + * + * @param title - The title to use + */ + setTitle(title: string): this; + /** + * Sets the custom id of this modal. + * + * @param customId - The custom id to use + */ + setCustomId(customId: string): this; + /** + * Adds components to this modal. + * + * @param components - The components to add + */ + addComponents(...components: RestOrArray | APIActionRowComponent>): this; + /** + * Sets components for this modal. + * + * @param components - The components to set + */ + setComponents(...components: RestOrArray>): this; + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON(): APIModalInteractionResponseCallbackData; +} + +declare const titleValidator: _sapphire_shapeshift.StringValidator; +declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[ActionRowBuilder, ...ActionRowBuilder[]], ActionRowBuilder>; +declare function validateRequiredParameters$2(customId?: string, title?: string, components?: ActionRowBuilder[]): void; + +declare const Assertions$2_componentsValidator: typeof componentsValidator; +declare const Assertions$2_titleValidator: typeof titleValidator; +declare namespace Assertions$2 { + export { + Assertions$2_componentsValidator as componentsValidator, + Assertions$2_titleValidator as titleValidator, + validateRequiredParameters$2 as validateRequiredParameters, + }; +} + +/** + * This mixin holds name and description symbols for slash commands. + */ +declare class SharedNameAndDescription { + /** + * The name of this command. + */ + readonly name: string; + /** + * The name localizations of this command. + */ + readonly name_localizations?: LocalizationMap; + /** + * The description of this command. + */ + readonly description: string; + /** + * The description localizations of this command. + */ + readonly description_localizations?: LocalizationMap; + /** + * Sets the name of this command. + * + * @param name - The name to use + */ + setName(name: string): this; + /** + * Sets the description of this command. + * + * @param description - The description to use + */ + setDescription(description: string): this; + /** + * Sets a name localization for this command. + * + * @param locale - The locale to set + * @param localizedName - The localized name for the given `locale` + */ + setNameLocalization(locale: LocaleString, localizedName: string | null): this; + /** + * Sets the name localizations for this command. + * + * @param localizedNames - The object of localized names to set + */ + setNameLocalizations(localizedNames: LocalizationMap | null): this; + /** + * Sets a description localization for this command. + * + * @param locale - The locale to set + * @param localizedDescription - The localized description for the given locale + */ + setDescriptionLocalization(locale: LocaleString, localizedDescription: string | null): this; + /** + * Sets the description localizations for this command. + * + * @param localizedDescriptions - The object of localized descriptions to set + */ + setDescriptionLocalizations(localizedDescriptions: LocalizationMap | null): this; +} + +/** + * The base application command option builder that contains common symbols for application command builders. + */ +declare abstract class ApplicationCommandOptionBase extends SharedNameAndDescription { + /** + * The type of this option. + */ + abstract readonly type: ApplicationCommandOptionType; + /** + * Whether this option is required. + * + * @defaultValue `false` + */ + readonly required: boolean; + /** + * Sets whether this option is required. + * + * @param required - Whether this option should be required + */ + setRequired(required: boolean): this; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + abstract toJSON(): APIApplicationCommandBasicOption; + /** + * This method runs required validators on this builder. + */ + protected runRequiredValidations(): void; +} + +/** + * A slash command attachment option. + */ +declare class SlashCommandAttachmentOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Attachment; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandAttachmentOption; +} + +/** + * A slash command boolean option. + */ +declare class SlashCommandBooleanOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Boolean; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandBooleanOption; +} + +/** + * The allowed channel types used for a channel option in a slash command builder. + * + * @privateRemarks This can't be dynamic because const enums are erased at runtime. + * @internal + */ +declare const allowedChannelTypes: readonly [ChannelType.GuildText, ChannelType.GuildVoice, ChannelType.GuildCategory, ChannelType.GuildAnnouncement, ChannelType.AnnouncementThread, ChannelType.PublicThread, ChannelType.PrivateThread, ChannelType.GuildStageVoice, ChannelType.GuildForum, ChannelType.GuildMedia]; +/** + * The type of allowed channel types used for a channel option. + */ +type ApplicationCommandOptionAllowedChannelTypes = (typeof allowedChannelTypes)[number]; +/** + * This mixin holds channel type symbols used for options. + */ +declare class ApplicationCommandOptionChannelTypesMixin { + /** + * The channel types of this option. + */ + readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[]; + /** + * Adds channel types to this option. + * + * @param channelTypes - The channel types + */ + addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]): this; +} + +/** + * A slash command channel option. + */ +declare class SlashCommandChannelOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Channel; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandChannelOption; +} +interface SlashCommandChannelOption extends ApplicationCommandOptionChannelTypesMixin { +} + +/** + * This mixin holds minimum and maximum symbols used for options. + */ +declare abstract class ApplicationCommandNumericOptionMinMaxValueMixin { + /** + * The maximum value of this option. + */ + readonly max_value?: number; + /** + * The minimum value of this option. + */ + readonly min_value?: number; + /** + * Sets the maximum number value of this option. + * + * @param max - The maximum value this option can be + */ + abstract setMaxValue(max: number): this; + /** + * Sets the minimum number value of this option. + * + * @param min - The minimum value this option can be + */ + abstract setMinValue(min: number): this; +} + +/** + * This mixin holds choices and autocomplete symbols used for options. + */ +declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin { + /** + * The choices of this option. + */ + readonly choices?: APIApplicationCommandOptionChoice[]; + /** + * Whether this option utilizes autocomplete. + */ + readonly autocomplete?: boolean; + /** + * The type of this option. + * + * @privateRemarks Since this is present and this is a mixin, this is needed. + */ + readonly type: ApplicationCommandOptionType; + /** + * Adds multiple choices to this option. + * + * @param choices - The choices to add + */ + addChoices(...choices: APIApplicationCommandOptionChoice[]): this; + /** + * Sets multiple choices for this option. + * + * @param choices - The choices to set + */ + setChoices[]>(...choices: Input): this; + /** + * Whether this option uses autocomplete. + * + * @param autocomplete - Whether this option should use autocomplete + */ + setAutocomplete(autocomplete: boolean): this; +} + +/** + * A slash command integer option. + */ +declare class SlashCommandIntegerOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Integer; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue} + */ + setMaxValue(max: number): this; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue} + */ + setMinValue(min: number): this; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandIntegerOption; +} +interface SlashCommandIntegerOption extends ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin { +} + +/** + * A slash command mentionable option. + */ +declare class SlashCommandMentionableOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Mentionable; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandMentionableOption; +} + +/** + * A slash command number option. + */ +declare class SlashCommandNumberOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Number; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue} + */ + setMaxValue(max: number): this; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue} + */ + setMinValue(min: number): this; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandNumberOption; +} +interface SlashCommandNumberOption extends ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin { +} + +/** + * A slash command role option. + */ +declare class SlashCommandRoleOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.Role; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandRoleOption; +} + +/** + * A slash command string option. + */ +declare class SlashCommandStringOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.String; + /** + * The maximum length of this option. + */ + readonly max_length?: number; + /** + * The minimum length of this option. + */ + readonly min_length?: number; + /** + * Sets the maximum length of this string option. + * + * @param max - The maximum length this option can be + */ + setMaxLength(max: number): this; + /** + * Sets the minimum length of this string option. + * + * @param min - The minimum length this option can be + */ + setMinLength(min: number): this; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandStringOption; +} +interface SlashCommandStringOption extends ApplicationCommandOptionWithChoicesAndAutocompleteMixin { +} + +/** + * A slash command user option. + */ +declare class SlashCommandUserOption extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + readonly type: ApplicationCommandOptionType.User; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON(): APIApplicationCommandUserOption; +} + +/** + * This mixin holds symbols that can be shared in slash command options. + * + * @typeParam ShouldOmitSubcommandFunctions - Whether to omit subcommand functions. + */ +declare class SharedSlashCommandOptions { + readonly options: ToAPIApplicationCommandOptions[]; + /** + * Adds a boolean option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a user option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a channel option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a role option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds an attachment option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addAttachmentOption(input: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a mentionable option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addMentionableOption(input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a string option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addStringOption(input: Omit | Omit | SlashCommandStringOption | ((builder: SlashCommandStringOption) => Omit | Omit | SlashCommandStringOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds an integer option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addIntegerOption(input: Omit | Omit | SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => Omit | Omit | SlashCommandIntegerOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Adds a number option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addNumberOption(input: Omit | Omit | SlashCommandNumberOption | ((builder: SlashCommandNumberOption) => Omit | Omit | SlashCommandNumberOption)): ShouldOmitSubcommandFunctions extends true ? Omit : this; + /** + * Where the actual adding magic happens. ✨ + * + * @param input - The input. What else? + * @param Instance - The instance of whatever is being added + * @internal + */ + private _sharedAddOptionMethod; +} + +/** + * Represents a folder for subcommands. + * + * @see {@link https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups} + */ +declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions { + /** + * The name of this subcommand group. + */ + readonly name: string; + /** + * The description of this subcommand group. + */ + readonly description: string; + /** + * The subcommands within this subcommand group. + */ + readonly options: SlashCommandSubcommandBuilder[]; + /** + * Adds a new subcommand to this group. + * + * @param input - A function that returns a subcommand builder or an already built builder + */ + addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): APIApplicationCommandSubcommandGroupOption; +} +interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription { +} +/** + * A builder that creates API-compatible JSON data for slash command subcommands. + * + * @see {@link https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups} + */ +declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions { + /** + * The name of this subcommand. + */ + readonly name: string; + /** + * The description of this subcommand. + */ + readonly description: string; + /** + * The options within this subcommand. + */ + readonly options: ApplicationCommandOptionBase[]; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): APIApplicationCommandSubcommandOption; +} +interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions { +} + +/** + * A builder that creates API-compatible JSON data for slash commands. + */ +declare class SlashCommandBuilder { + /** + * The name of this command. + */ + readonly name: string; + /** + * The name localizations of this command. + */ + readonly name_localizations?: LocalizationMap; + /** + * The description of this command. + */ + readonly description: string; + /** + * The description localizations of this command. + */ + readonly description_localizations?: LocalizationMap; + /** + * The options of this command. + */ + readonly options: ToAPIApplicationCommandOptions[]; + /** + * Whether this command is enabled by default when the application is added to a guild. + * + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + readonly default_permission: boolean | undefined; + /** + * The set of permissions represented as a bit set for the command. + */ + readonly default_member_permissions: Permissions | null | undefined; + /** + * Indicates whether the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This property is only for global commands. + */ + readonly dm_permission: boolean | undefined; + /** + * Whether this command is NSFW. + */ + readonly nsfw: boolean | undefined; + /** + * Sets whether the command is enabled by default when the application is added to a guild. + * + * @remarks + * If set to `false`, you will have to later `PUT` the permissions for this command. + * @param value - Whether or not to enable this command by default + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + * @deprecated Use {@link SlashCommandBuilder.setDefaultMemberPermissions} or {@link SlashCommandBuilder.setDMPermission} instead. + */ + setDefaultPermission(value: boolean): this; + /** + * Sets the default permissions a member should have in order to run the command. + * + * @remarks + * You can set this to `'0'` to disable the command by default. + * @param permissions - The permissions bit field to set + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined): this; + /** + * Sets if the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This method is only for global commands. + * @param enabled - Whether the command should be enabled in direct messages + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDMPermission(enabled: boolean | null | undefined): this; + /** + * Sets whether this command is NSFW. + * + * @param nsfw - Whether this command is NSFW + */ + setNSFW(nsfw?: boolean): this; + /** + * 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)): SlashCommandSubcommandsOnlyBuilder; + /** + * 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; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): RESTPostAPIChatInputApplicationCommandsJSONBody; +} +interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions { +} +/** + * An interface specifically for slash command subcommands. + */ +interface SlashCommandSubcommandsOnlyBuilder extends Omit> { +} +/** + * An interface specifically for slash command options. + */ +interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick { +} +/** + * An interface that ensures the `toJSON()` call will return something + * that can be serialized into API-compatible data. + */ +interface ToAPIApplicationCommandOptions { + toJSON(): APIApplicationCommandOption; +} + +declare function validateName$1(name: unknown): asserts name is string; +declare function validateDescription(description: unknown): asserts description is string; +declare function validateLocale(locale: unknown): Locale; +declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[]; +declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void; +declare function validateDefaultPermission$1(value: unknown): asserts value is boolean; +declare function validateRequired(required: unknown): asserts required is boolean; +declare function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void; +declare function assertReturnOfBuilder(input: unknown, ExpectedInstanceOf: new () => ReturnType): asserts input is ReturnType; +declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<_sapphire_shapeshift.UndefinedToOptional>> | null | undefined>; +declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap; +declare function validateDMPermission$1(value: unknown): asserts value is boolean | null | undefined; +declare function validateDefaultMemberPermissions$1(permissions: unknown): string | null | undefined; +declare function validateNSFW(value: unknown): asserts value is boolean; + +declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder; +declare const Assertions$1_localizationMapPredicate: typeof localizationMapPredicate; +declare const Assertions$1_validateChoicesLength: typeof validateChoicesLength; +declare const Assertions$1_validateDescription: typeof validateDescription; +declare const Assertions$1_validateLocale: typeof validateLocale; +declare const Assertions$1_validateLocalizationMap: typeof validateLocalizationMap; +declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLength; +declare const Assertions$1_validateNSFW: typeof validateNSFW; +declare const Assertions$1_validateRequired: typeof validateRequired; +declare namespace Assertions$1 { + export { + Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder, + Assertions$1_localizationMapPredicate as localizationMapPredicate, + Assertions$1_validateChoicesLength as validateChoicesLength, + validateDMPermission$1 as validateDMPermission, + validateDefaultMemberPermissions$1 as validateDefaultMemberPermissions, + validateDefaultPermission$1 as validateDefaultPermission, + Assertions$1_validateDescription as validateDescription, + Assertions$1_validateLocale as validateLocale, + Assertions$1_validateLocalizationMap as validateLocalizationMap, + Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength, + Assertions$1_validateNSFW as validateNSFW, + validateName$1 as validateName, + Assertions$1_validateRequired as validateRequired, + validateRequiredParameters$1 as validateRequiredParameters, + }; +} + +/** + * The type a context menu command can be. + */ +type ContextMenuCommandType = ApplicationCommandType.Message | ApplicationCommandType.User; +/** + * A builder that creates API-compatible JSON data for context menu commands. + */ +declare class ContextMenuCommandBuilder { + /** + * The name of this command. + */ + readonly name: string; + /** + * The name localizations of this command. + */ + readonly name_localizations?: LocalizationMap; + /** + * The type of this command. + */ + readonly type: ContextMenuCommandType; + /** + * Whether this command is enabled by default when the application is added to a guild. + * + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + readonly default_permission: boolean | undefined; + /** + * The set of permissions represented as a bit set for the command. + */ + readonly default_member_permissions: Permissions | null | undefined; + /** + * Indicates whether the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This property is only for global commands. + */ + readonly dm_permission: boolean | undefined; + /** + * Sets the name of this command. + * + * @param name - The name to use + */ + setName(name: string): this; + /** + * Sets the type of this command. + * + * @param type - The type to use + */ + setType(type: ContextMenuCommandType): this; + /** + * Sets whether the command is enabled by default when the application is added to a guild. + * + * @remarks + * If set to `false`, you will have to later `PUT` the permissions for this command. + * @param value - Whether to enable this command by default + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + setDefaultPermission(value: boolean): this; + /** + * Sets the default permissions a member should have in order to run this command. + * + * @remarks + * You can set this to `'0'` to disable the command by default. + * @param permissions - The permissions bit field to set + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined): this; + /** + * Sets if the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This method is only for global commands. + * @param enabled - Whether the command should be enabled in direct messages + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDMPermission(enabled: boolean | null | undefined): this; + /** + * Sets a name localization for this command. + * + * @param locale - The locale to set + * @param localizedName - The localized name for the given `locale` + */ + setNameLocalization(locale: LocaleString, localizedName: string | null): this; + /** + * Sets the name localizations for this command. + * + * @param localizedNames - The object of localized names to set + */ + setNameLocalizations(localizedNames: LocalizationMap | null): this; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON(): RESTPostAPIContextMenuApplicationCommandsJSONBody; +} + +declare function validateDefaultPermission(value: unknown): asserts value is boolean; +declare function validateName(name: unknown): asserts name is string; +declare function validateType(type: unknown): asserts type is ContextMenuCommandType; +declare function validateRequiredParameters(name: string, type: number): void; +declare function validateDMPermission(value: unknown): asserts value is boolean | null | undefined; +declare function validateDefaultMemberPermissions(permissions: unknown): string | null | undefined; + +declare const Assertions_validateDMPermission: typeof validateDMPermission; +declare const Assertions_validateDefaultMemberPermissions: typeof validateDefaultMemberPermissions; +declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission; +declare const Assertions_validateName: typeof validateName; +declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters; +declare const Assertions_validateType: typeof validateType; +declare namespace Assertions { + export { + Assertions_validateDMPermission as validateDMPermission, + Assertions_validateDefaultMemberPermissions as validateDefaultMemberPermissions, + Assertions_validateDefaultPermission as validateDefaultPermission, + Assertions_validateName as validateName, + Assertions_validateRequiredParameters as validateRequiredParameters, + Assertions_validateType as validateType, + }; +} + +/** + * Calculates the length of the embed. + * + * @param data - The embed data to check + */ +declare function embedLength(data: APIEmbed): number; + +/** + * Enables validators. + * + * @returns Whether validation is occurring. + */ +declare function enableValidators(): boolean; +/** + * Disables validators. + * + * @returns Whether validation is occurring. + */ +declare function disableValidators(): boolean; +/** + * Checks whether validation is occurring. + */ +declare function isValidationEnabled(): boolean; + +/** + * The {@link https://github.com/discordjs/discord.js/blob/main/packages/builders#readme | @discordjs/builders} 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 { ActionRowBuilder, AnyAPIActionRowComponent, AnyComponentBuilder, ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, ApplicationCommandOptionChannelTypesMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin, BaseSelectMenuBuilder, ButtonBuilder, ChannelSelectMenuBuilder, Assertions$4 as ComponentAssertions, ComponentBuilder, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Assertions$5 as EmbedAssertions, EmbedAuthorData, EmbedAuthorOptions, EmbedBuilder, EmbedFooterData, EmbedFooterOptions, EmbedImageData, IconData, MappedComponentTypes, MentionableSelectMenuBuilder, MessageActionRowComponentBuilder, MessageComponentBuilder, ModalActionRowComponentBuilder, Assertions$2 as ModalAssertions, ModalBuilder, ModalComponentBuilder, RGBTuple, RestOrArray, RoleSelectMenuBuilder, StringSelectMenuBuilder as SelectMenuBuilder, StringSelectMenuOptionBuilder as SelectMenuOptionBuilder, SharedNameAndDescription, SharedSlashCommandOptions, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, Assertions$3 as TextInputAssertions, TextInputBuilder, ToAPIApplicationCommandOptions, UserSelectMenuBuilder, createComponentBuilder, disableValidators, embedLength, enableValidators, isValidationEnabled, normalizeArray, version }; diff --git a/node_modules/@discordjs/builders/dist/index.js b/node_modules/@discordjs/builders/dist/index.js new file mode 100644 index 0000000..5bd7a7b --- /dev/null +++ b/node_modules/@discordjs/builders/dist/index.js @@ -0,0 +1,2763 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __decorateClass = (decorators, target, key, kind) => { + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; + for (var i = decorators.length - 1, decorator; i >= 0; i--) + if (decorator = decorators[i]) + result = (kind ? decorator(target, key, result) : decorator(result)) || result; + if (kind && result) + __defProp(target, key, result); + return result; +}; + +// src/index.ts +var src_exports = {}; +__export(src_exports, { + ActionRowBuilder: () => ActionRowBuilder, + ApplicationCommandNumericOptionMinMaxValueMixin: () => ApplicationCommandNumericOptionMinMaxValueMixin, + ApplicationCommandOptionBase: () => ApplicationCommandOptionBase, + ApplicationCommandOptionChannelTypesMixin: () => ApplicationCommandOptionChannelTypesMixin, + ApplicationCommandOptionWithChoicesAndAutocompleteMixin: () => ApplicationCommandOptionWithChoicesAndAutocompleteMixin, + BaseSelectMenuBuilder: () => BaseSelectMenuBuilder, + ButtonBuilder: () => ButtonBuilder, + ChannelSelectMenuBuilder: () => ChannelSelectMenuBuilder, + ComponentAssertions: () => Assertions_exports2, + ComponentBuilder: () => ComponentBuilder, + ContextMenuCommandAssertions: () => Assertions_exports6, + ContextMenuCommandBuilder: () => ContextMenuCommandBuilder, + EmbedAssertions: () => Assertions_exports, + EmbedBuilder: () => EmbedBuilder, + MentionableSelectMenuBuilder: () => MentionableSelectMenuBuilder, + ModalAssertions: () => Assertions_exports4, + ModalBuilder: () => ModalBuilder, + RoleSelectMenuBuilder: () => RoleSelectMenuBuilder, + SelectMenuBuilder: () => StringSelectMenuBuilder, + SelectMenuOptionBuilder: () => StringSelectMenuOptionBuilder, + SharedNameAndDescription: () => SharedNameAndDescription, + SharedSlashCommandOptions: () => SharedSlashCommandOptions, + SlashCommandAssertions: () => Assertions_exports5, + SlashCommandAttachmentOption: () => SlashCommandAttachmentOption, + SlashCommandBooleanOption: () => SlashCommandBooleanOption, + SlashCommandBuilder: () => SlashCommandBuilder, + SlashCommandChannelOption: () => SlashCommandChannelOption, + SlashCommandIntegerOption: () => SlashCommandIntegerOption, + SlashCommandMentionableOption: () => SlashCommandMentionableOption, + SlashCommandNumberOption: () => SlashCommandNumberOption, + SlashCommandRoleOption: () => SlashCommandRoleOption, + SlashCommandStringOption: () => SlashCommandStringOption, + SlashCommandSubcommandBuilder: () => SlashCommandSubcommandBuilder, + SlashCommandSubcommandGroupBuilder: () => SlashCommandSubcommandGroupBuilder, + SlashCommandUserOption: () => SlashCommandUserOption, + StringSelectMenuBuilder: () => StringSelectMenuBuilder, + StringSelectMenuOptionBuilder: () => StringSelectMenuOptionBuilder, + TextInputAssertions: () => Assertions_exports3, + TextInputBuilder: () => TextInputBuilder, + UserSelectMenuBuilder: () => UserSelectMenuBuilder, + createComponentBuilder: () => createComponentBuilder, + disableValidators: () => disableValidators, + embedLength: () => embedLength, + enableValidators: () => enableValidators, + isValidationEnabled: () => isValidationEnabled, + normalizeArray: () => normalizeArray, + version: () => version +}); +module.exports = __toCommonJS(src_exports); + +// src/messages/embed/Assertions.ts +var Assertions_exports = {}; +__export(Assertions_exports, { + RGBPredicate: () => RGBPredicate, + authorNamePredicate: () => authorNamePredicate, + colorPredicate: () => colorPredicate, + descriptionPredicate: () => descriptionPredicate, + embedAuthorPredicate: () => embedAuthorPredicate, + embedFieldPredicate: () => embedFieldPredicate, + embedFieldsArrayPredicate: () => embedFieldsArrayPredicate, + embedFooterPredicate: () => embedFooterPredicate, + fieldInlinePredicate: () => fieldInlinePredicate, + fieldLengthPredicate: () => fieldLengthPredicate, + fieldNamePredicate: () => fieldNamePredicate, + fieldValuePredicate: () => fieldValuePredicate, + footerTextPredicate: () => footerTextPredicate, + imageURLPredicate: () => imageURLPredicate, + timestampPredicate: () => timestampPredicate, + titlePredicate: () => titlePredicate, + urlPredicate: () => urlPredicate, + validateFieldLength: () => validateFieldLength +}); +var import_shapeshift = require("@sapphire/shapeshift"); + +// src/util/validation.ts +var validate = true; +function enableValidators() { + return validate = true; +} +__name(enableValidators, "enableValidators"); +function disableValidators() { + return validate = false; +} +__name(disableValidators, "disableValidators"); +function isValidationEnabled() { + return validate; +} +__name(isValidationEnabled, "isValidationEnabled"); + +// src/messages/embed/Assertions.ts +var fieldNamePredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(256).setValidationEnabled(isValidationEnabled); +var fieldValuePredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024).setValidationEnabled(isValidationEnabled); +var fieldInlinePredicate = import_shapeshift.s.boolean.optional; +var embedFieldPredicate = import_shapeshift.s.object({ + name: fieldNamePredicate, + value: fieldValuePredicate, + inline: fieldInlinePredicate +}).setValidationEnabled(isValidationEnabled); +var embedFieldsArrayPredicate = embedFieldPredicate.array.setValidationEnabled(isValidationEnabled); +var fieldLengthPredicate = import_shapeshift.s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +function validateFieldLength(amountAdding, fields) { + fieldLengthPredicate.parse((fields?.length ?? 0) + amountAdding); +} +__name(validateFieldLength, "validateFieldLength"); +var authorNamePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled); +var imageURLPredicate = import_shapeshift.s.string.url({ + allowedProtocols: ["http:", "https:", "attachment:"] +}).nullish.setValidationEnabled(isValidationEnabled); +var urlPredicate = import_shapeshift.s.string.url({ + allowedProtocols: ["http:", "https:"] +}).nullish.setValidationEnabled(isValidationEnabled); +var embedAuthorPredicate = import_shapeshift.s.object({ + name: authorNamePredicate, + iconURL: imageURLPredicate, + url: urlPredicate +}).setValidationEnabled(isValidationEnabled); +var RGBPredicate = import_shapeshift.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(255).setValidationEnabled(isValidationEnabled); +var colorPredicate = import_shapeshift.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(16777215).or(import_shapeshift.s.tuple([RGBPredicate, RGBPredicate, RGBPredicate])).nullable.setValidationEnabled(isValidationEnabled); +var descriptionPredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4096).nullable.setValidationEnabled(isValidationEnabled); +var footerTextPredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(2048).nullable.setValidationEnabled(isValidationEnabled); +var embedFooterPredicate = import_shapeshift.s.object({ + text: footerTextPredicate, + iconURL: imageURLPredicate +}).setValidationEnabled(isValidationEnabled); +var timestampPredicate = import_shapeshift.s.union(import_shapeshift.s.number, import_shapeshift.s.date).nullable.setValidationEnabled(isValidationEnabled); +var titlePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled); + +// src/util/normalizeArray.ts +function normalizeArray(arr) { + if (Array.isArray(arr[0])) + return arr[0]; + return arr; +} +__name(normalizeArray, "normalizeArray"); + +// src/messages/embed/Embed.ts +var EmbedBuilder = class { + static { + __name(this, "EmbedBuilder"); + } + /** + * The API data associated with this embed. + */ + data; + /** + * Creates a new embed from API data. + * + * @param data - The API data to create this embed with + */ + constructor(data = {}) { + this.data = { ...data }; + if (data.timestamp) + this.data.timestamp = new Date(data.timestamp).toISOString(); + } + /** + * Appends fields to the embed. + * + * @remarks + * This method accepts either an array of fields or a variable number of field parameters. + * The maximum amount of fields that can be added is 25. + * @example + * Using an array: + * ```ts + * const fields: APIEmbedField[] = ...; + * const embed = new EmbedBuilder() + * .addFields(fields); + * ``` + * @example + * Using rest parameters (variadic): + * ```ts + * const embed = new EmbedBuilder() + * .addFields( + * { name: 'Field 1', value: 'Value 1' }, + * { name: 'Field 2', value: 'Value 2' }, + * ); + * ``` + * @param fields - The fields to add + */ + addFields(...fields) { + const normalizedFields = normalizeArray(fields); + validateFieldLength(normalizedFields.length, this.data.fields); + embedFieldsArrayPredicate.parse(normalizedFields); + if (this.data.fields) + this.data.fields.push(...normalizedFields); + else + this.data.fields = normalizedFields; + return this; + } + /** + * Removes, replaces, or inserts fields for this embed. + * + * @remarks + * This method behaves similarly + * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}. + * The maximum amount of fields that can be added is 25. + * + * It's useful for modifying and adjusting order of the already-existing fields of an embed. + * @example + * Remove the first field: + * ```ts + * embed.spliceFields(0, 1); + * ``` + * @example + * Remove the first n fields: + * ```ts + * const n = 4; + * embed.spliceFields(0, n); + * ``` + * @example + * Remove the last field: + * ```ts + * embed.spliceFields(-1, 1); + * ``` + * @param index - The index to start at + * @param deleteCount - The number of fields to remove + * @param fields - The replacing field objects + */ + spliceFields(index, deleteCount, ...fields) { + validateFieldLength(fields.length - deleteCount, this.data.fields); + embedFieldsArrayPredicate.parse(fields); + if (this.data.fields) + this.data.fields.splice(index, deleteCount, ...fields); + else + this.data.fields = fields; + return this; + } + /** + * Sets the fields for this embed. + * + * @remarks + * This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically, + * it splices the entire array of fields, replacing them with the provided fields. + * + * You can set a maximum of 25 fields. + * @param fields - The fields to set + */ + setFields(...fields) { + this.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields)); + return this; + } + /** + * Sets the author of this embed. + * + * @param options - The options to use + */ + setAuthor(options) { + if (options === null) { + this.data.author = void 0; + return this; + } + embedAuthorPredicate.parse(options); + this.data.author = { name: options.name, url: options.url, icon_url: options.iconURL }; + return this; + } + /** + * Sets the color of this embed. + * + * @param color - The color to use + */ + setColor(color) { + colorPredicate.parse(color); + if (Array.isArray(color)) { + const [red, green, blue] = color; + this.data.color = (red << 16) + (green << 8) + blue; + return this; + } + this.data.color = color ?? void 0; + return this; + } + /** + * Sets the description of this embed. + * + * @param description - The description to use + */ + setDescription(description) { + descriptionPredicate.parse(description); + this.data.description = description ?? void 0; + return this; + } + /** + * Sets the footer of this embed. + * + * @param options - The footer to use + */ + setFooter(options) { + if (options === null) { + this.data.footer = void 0; + return this; + } + embedFooterPredicate.parse(options); + this.data.footer = { text: options.text, icon_url: options.iconURL }; + return this; + } + /** + * Sets the image of this embed. + * + * @param url - The image URL to use + */ + setImage(url) { + imageURLPredicate.parse(url); + this.data.image = url ? { url } : void 0; + return this; + } + /** + * Sets the thumbnail of this embed. + * + * @param url - The thumbnail URL to use + */ + setThumbnail(url) { + imageURLPredicate.parse(url); + this.data.thumbnail = url ? { url } : void 0; + return this; + } + /** + * Sets the timestamp of this embed. + * + * @param timestamp - The timestamp or date to use + */ + setTimestamp(timestamp = Date.now()) { + timestampPredicate.parse(timestamp); + this.data.timestamp = timestamp ? new Date(timestamp).toISOString() : void 0; + return this; + } + /** + * Sets the title for this embed. + * + * @param title - The title to use + */ + setTitle(title) { + titlePredicate.parse(title); + this.data.title = title ?? void 0; + return this; + } + /** + * Sets the URL of this embed. + * + * @param url - The URL to use + */ + setURL(url) { + urlPredicate.parse(url); + this.data.url = url ?? void 0; + return this; + } + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + return { ...this.data }; + } +}; + +// src/index.ts +__reExport(src_exports, require("@discordjs/formatters"), module.exports); + +// src/components/Assertions.ts +var Assertions_exports2 = {}; +__export(Assertions_exports2, { + buttonLabelValidator: () => buttonLabelValidator, + buttonStyleValidator: () => buttonStyleValidator, + channelTypesValidator: () => channelTypesValidator, + customIdValidator: () => customIdValidator, + defaultValidator: () => defaultValidator, + disabledValidator: () => disabledValidator, + emojiValidator: () => emojiValidator, + jsonOptionValidator: () => jsonOptionValidator, + labelValueDescriptionValidator: () => labelValueDescriptionValidator, + minMaxValidator: () => minMaxValidator, + optionValidator: () => optionValidator, + optionsLengthValidator: () => optionsLengthValidator, + optionsValidator: () => optionsValidator, + placeholderValidator: () => placeholderValidator, + urlValidator: () => urlValidator, + validateRequiredButtonParameters: () => validateRequiredButtonParameters, + validateRequiredSelectMenuOptionParameters: () => validateRequiredSelectMenuOptionParameters, + validateRequiredSelectMenuParameters: () => validateRequiredSelectMenuParameters +}); +var import_shapeshift2 = require("@sapphire/shapeshift"); +var import_v10 = require("discord-api-types/v10"); + +// src/components/selectMenu/StringSelectMenuOption.ts +var StringSelectMenuOptionBuilder = class { + /** + * Creates a new string select menu option from API data. + * + * @param data - The API data to create this string select menu option with + * @example + * Creating a string select menu option from an API data object: + * ```ts + * const selectMenuOption = new SelectMenuOptionBuilder({ + * label: 'catchy label', + * value: '1', + * }); + * ``` + * @example + * Creating a string select menu option using setters and API data: + * ```ts + * const selectMenuOption = new SelectMenuOptionBuilder({ + * default: true, + * value: '1', + * }) + * .setLabel('woah'); + * ``` + */ + constructor(data = {}) { + this.data = data; + } + static { + __name(this, "StringSelectMenuOptionBuilder"); + } + /** + * Sets the label for this option. + * + * @param label - The label to use + */ + setLabel(label) { + this.data.label = labelValueDescriptionValidator.parse(label); + return this; + } + /** + * Sets the value for this option. + * + * @param value - The value to use + */ + setValue(value) { + this.data.value = labelValueDescriptionValidator.parse(value); + return this; + } + /** + * Sets the description for this option. + * + * @param description - The description to use + */ + setDescription(description) { + this.data.description = labelValueDescriptionValidator.parse(description); + return this; + } + /** + * Sets whether this option is selected by default. + * + * @param isDefault - Whether this option is selected by default + */ + setDefault(isDefault = true) { + this.data.default = defaultValidator.parse(isDefault); + return this; + } + /** + * Sets the emoji to display for this option. + * + * @param emoji - The emoji to use + */ + setEmoji(emoji) { + this.data.emoji = emojiValidator.parse(emoji); + return this; + } + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON() { + validateRequiredSelectMenuOptionParameters(this.data.label, this.data.value); + return { + ...this.data + }; + } +}; + +// src/components/Assertions.ts +var customIdValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled); +var emojiValidator = import_shapeshift2.s.object({ + id: import_shapeshift2.s.string, + name: import_shapeshift2.s.string, + animated: import_shapeshift2.s.boolean +}).partial.strict.setValidationEnabled(isValidationEnabled); +var disabledValidator = import_shapeshift2.s.boolean; +var buttonLabelValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(80).setValidationEnabled(isValidationEnabled); +var buttonStyleValidator = import_shapeshift2.s.nativeEnum(import_v10.ButtonStyle); +var placeholderValidator = import_shapeshift2.s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled); +var minMaxValidator = import_shapeshift2.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +var labelValueDescriptionValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled); +var jsonOptionValidator = import_shapeshift2.s.object({ + label: labelValueDescriptionValidator, + value: labelValueDescriptionValidator, + description: labelValueDescriptionValidator.optional, + emoji: emojiValidator.optional, + default: import_shapeshift2.s.boolean.optional +}).setValidationEnabled(isValidationEnabled); +var optionValidator = import_shapeshift2.s.instance(StringSelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled); +var optionsValidator = optionValidator.array.lengthGreaterThanOrEqual(0).setValidationEnabled(isValidationEnabled); +var optionsLengthValidator = import_shapeshift2.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +function validateRequiredSelectMenuParameters(options, customId) { + customIdValidator.parse(customId); + optionsValidator.parse(options); +} +__name(validateRequiredSelectMenuParameters, "validateRequiredSelectMenuParameters"); +var defaultValidator = import_shapeshift2.s.boolean; +function validateRequiredSelectMenuOptionParameters(label, value) { + labelValueDescriptionValidator.parse(label); + labelValueDescriptionValidator.parse(value); +} +__name(validateRequiredSelectMenuOptionParameters, "validateRequiredSelectMenuOptionParameters"); +var channelTypesValidator = import_shapeshift2.s.nativeEnum(import_v10.ChannelType).array.setValidationEnabled(isValidationEnabled); +var urlValidator = import_shapeshift2.s.string.url({ + allowedProtocols: ["http:", "https:", "discord:"] +}).setValidationEnabled(isValidationEnabled); +function validateRequiredButtonParameters(style, label, emoji, customId, url) { + if (url && customId) { + throw new RangeError("URL and custom id are mutually exclusive"); + } + if (!label && !emoji) { + throw new RangeError("Buttons must have a label and/or an emoji"); + } + if (style === import_v10.ButtonStyle.Link) { + if (!url) { + throw new RangeError("Link buttons must have a url"); + } + } else if (url) { + throw new RangeError("Non-link buttons cannot have a url"); + } +} +__name(validateRequiredButtonParameters, "validateRequiredButtonParameters"); + +// src/components/ActionRow.ts +var import_v1011 = require("discord-api-types/v10"); + +// src/components/Component.ts +var ComponentBuilder = class { + static { + __name(this, "ComponentBuilder"); + } + /** + * The API data associated with this component. + */ + data; + /** + * Constructs a new kind of component. + * + * @param data - The data to construct a component out of + */ + constructor(data) { + this.data = data; + } +}; + +// src/components/Components.ts +var import_v1010 = require("discord-api-types/v10"); + +// src/components/button/Button.ts +var import_v102 = require("discord-api-types/v10"); +var ButtonBuilder = class extends ComponentBuilder { + static { + __name(this, "ButtonBuilder"); + } + /** + * Creates a new button from API data. + * + * @param data - The API data to create this button with + * @example + * Creating a button from an API data object: + * ```ts + * const button = new ButtonBuilder({ + * custom_id: 'a cool button', + * style: ButtonStyle.Primary, + * label: 'Click Me', + * emoji: { + * name: 'smile', + * id: '123456789012345678', + * }, + * }); + * ``` + * @example + * Creating a button using setters and API data: + * ```ts + * const button = new ButtonBuilder({ + * style: ButtonStyle.Secondary, + * label: 'Click Me', + * }) + * .setEmoji({ name: '🙂' }) + * .setCustomId('another cool button'); + * ``` + */ + constructor(data) { + super({ type: import_v102.ComponentType.Button, ...data }); + } + /** + * Sets the style of this button. + * + * @param style - The style to use + */ + setStyle(style) { + this.data.style = buttonStyleValidator.parse(style); + return this; + } + /** + * Sets the URL for this button. + * + * @remarks + * This method is only available to buttons using the `Link` button style. + * Only three types of URL schemes are currently supported: `https://`, `http://`, and `discord://`. + * @param url - The URL to use + */ + setURL(url) { + this.data.url = urlValidator.parse(url); + return this; + } + /** + * Sets the custom id for this button. + * + * @remarks + * This method is only applicable to buttons that are not using the `Link` button style. + * @param customId - The custom id to use + */ + setCustomId(customId) { + this.data.custom_id = customIdValidator.parse(customId); + return this; + } + /** + * Sets the emoji to display on this button. + * + * @param emoji - The emoji to use + */ + setEmoji(emoji) { + this.data.emoji = emojiValidator.parse(emoji); + return this; + } + /** + * Sets whether this button is disabled. + * + * @param disabled - Whether to disable this button + */ + setDisabled(disabled = true) { + this.data.disabled = disabledValidator.parse(disabled); + return this; + } + /** + * Sets the label for this button. + * + * @param label - The label to use + */ + setLabel(label) { + this.data.label = buttonLabelValidator.parse(label); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + validateRequiredButtonParameters( + this.data.style, + this.data.label, + this.data.emoji, + this.data.custom_id, + this.data.url + ); + return { + ...this.data + }; + } +}; + +// src/components/selectMenu/ChannelSelectMenu.ts +var import_v103 = require("discord-api-types/v10"); + +// src/components/selectMenu/BaseSelectMenu.ts +var BaseSelectMenuBuilder = class extends ComponentBuilder { + static { + __name(this, "BaseSelectMenuBuilder"); + } + /** + * Sets the placeholder for this select menu. + * + * @param placeholder - The placeholder to use + */ + setPlaceholder(placeholder) { + this.data.placeholder = placeholderValidator.parse(placeholder); + return this; + } + /** + * Sets the minimum values that must be selected in the select menu. + * + * @param minValues - The minimum values that must be selected + */ + setMinValues(minValues) { + this.data.min_values = minMaxValidator.parse(minValues); + return this; + } + /** + * Sets the maximum values that must be selected in the select menu. + * + * @param maxValues - The maximum values that must be selected + */ + setMaxValues(maxValues) { + this.data.max_values = minMaxValidator.parse(maxValues); + return this; + } + /** + * Sets the custom id for this select menu. + * + * @param customId - The custom id to use + */ + setCustomId(customId) { + this.data.custom_id = customIdValidator.parse(customId); + return this; + } + /** + * Sets whether this select menu is disabled. + * + * @param disabled - Whether this select menu is disabled + */ + setDisabled(disabled = true) { + this.data.disabled = disabledValidator.parse(disabled); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + customIdValidator.parse(this.data.custom_id); + return { + ...this.data + }; + } +}; + +// src/components/selectMenu/ChannelSelectMenu.ts +var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "ChannelSelectMenuBuilder"); + } + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new ChannelSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new ChannelSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + * .setMinValues(2); + * ``` + */ + constructor(data) { + super({ ...data, type: import_v103.ComponentType.ChannelSelect }); + } + /** + * Adds channel types to this select menu. + * + * @param types - The channel types to use + */ + addChannelTypes(...types) { + const normalizedTypes = normalizeArray(types); + this.data.channel_types ??= []; + this.data.channel_types.push(...channelTypesValidator.parse(normalizedTypes)); + return this; + } + /** + * Sets channel types for this select menu. + * + * @param types - The channel types to use + */ + setChannelTypes(...types) { + const normalizedTypes = normalizeArray(types); + this.data.channel_types ??= []; + this.data.channel_types.splice(0, this.data.channel_types.length, ...channelTypesValidator.parse(normalizedTypes)); + return this; + } + /** + * Adds default channels to this auto populated select menu. + * + * @param channels - The channels to add + */ + addDefaultChannels(...channels) { + const normalizedValues = normalizeArray(channels); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: import_v103.SelectMenuDefaultValueType.Channel + })) + ); + return this; + } + /** + * Sets default channels to this auto populated select menu. + * + * @param channels - The channels to set + */ + setDefaultChannels(...channels) { + const normalizedValues = normalizeArray(channels); + optionsLengthValidator.parse(normalizedValues.length); + this.data.default_values = normalizedValues.map((id) => ({ + id, + type: import_v103.SelectMenuDefaultValueType.Channel + })); + return this; + } + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON() { + customIdValidator.parse(this.data.custom_id); + return { + ...this.data + }; + } +}; + +// src/components/selectMenu/MentionableSelectMenu.ts +var import_v104 = require("discord-api-types/v10"); +var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "MentionableSelectMenuBuilder"); + } + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new MentionableSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new MentionableSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data) { + super({ ...data, type: import_v104.ComponentType.MentionableSelect }); + } + /** + * Adds default roles to this auto populated select menu. + * + * @param roles - The roles to add + */ + addDefaultRoles(...roles) { + const normalizedValues = normalizeArray(roles); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: import_v104.SelectMenuDefaultValueType.Role + })) + ); + return this; + } + /** + * Adds default users to this auto populated select menu. + * + * @param users - The users to add + */ + addDefaultUsers(...users) { + const normalizedValues = normalizeArray(users); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: import_v104.SelectMenuDefaultValueType.User + })) + ); + return this; + } + /** + * Adds default values to this auto populated select menu. + * + * @param values - The values to add + */ + addDefaultValues(...values) { + const normalizedValues = normalizeArray(values); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push(...normalizedValues); + return this; + } + /** + * Sets default values to this auto populated select menu. + * + * @param values - The values to set + */ + setDefaultValues(...values) { + const normalizedValues = normalizeArray(values); + optionsLengthValidator.parse(normalizedValues.length); + this.data.default_values = normalizedValues.slice(); + return this; + } +}; + +// src/components/selectMenu/RoleSelectMenu.ts +var import_v105 = require("discord-api-types/v10"); +var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "RoleSelectMenuBuilder"); + } + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new RoleSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new RoleSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data) { + super({ ...data, type: import_v105.ComponentType.RoleSelect }); + } + /** + * Adds default roles to this auto populated select menu. + * + * @param roles - The roles to add + */ + addDefaultRoles(...roles) { + const normalizedValues = normalizeArray(roles); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: import_v105.SelectMenuDefaultValueType.Role + })) + ); + return this; + } + /** + * Sets default roles to this auto populated select menu. + * + * @param roles - The roles to set + */ + setDefaultRoles(...roles) { + const normalizedValues = normalizeArray(roles); + optionsLengthValidator.parse(normalizedValues.length); + this.data.default_values = normalizedValues.map((id) => ({ + id, + type: import_v105.SelectMenuDefaultValueType.Role + })); + return this; + } +}; + +// src/components/selectMenu/StringSelectMenu.ts +var import_v106 = require("discord-api-types/v10"); +var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "StringSelectMenuBuilder"); + } + /** + * The options within this select menu. + */ + options; + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new StringSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * options: [ + * { label: 'option 1', value: '1' }, + * { label: 'option 2', value: '2' }, + * { label: 'option 3', value: '3' }, + * ], + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new StringSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1) + * .addOptions({ + * label: 'Catchy', + * value: 'catch', + * }); + * ``` + */ + constructor(data) { + const { options, ...initData } = data ?? {}; + super({ ...initData, type: import_v106.ComponentType.StringSelect }); + this.options = options?.map((option) => new StringSelectMenuOptionBuilder(option)) ?? []; + } + /** + * Adds options to this select menu. + * + * @param options - The options to add + */ + addOptions(...options) { + const normalizedOptions = normalizeArray(options); + optionsLengthValidator.parse(this.options.length + normalizedOptions.length); + this.options.push( + ...normalizedOptions.map( + (normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)) + ) + ); + return this; + } + /** + * Sets the options for this select menu. + * + * @param options - The options to set + */ + setOptions(...options) { + return this.spliceOptions(0, this.options.length, ...options); + } + /** + * Removes, replaces, or inserts options for this select menu. + * + * @remarks + * This method behaves similarly + * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice()}. + * It's useful for modifying and adjusting the order of existing options. + * @example + * Remove the first option: + * ```ts + * selectMenu.spliceOptions(0, 1); + * ``` + * @example + * Remove the first n option: + * ```ts + * const n = 4; + * selectMenu.spliceOptions(0, n); + * ``` + * @example + * Remove the last option: + * ```ts + * selectMenu.spliceOptions(-1, 1); + * ``` + * @param index - The index to start at + * @param deleteCount - The number of options to remove + * @param options - The replacing option objects or builders + */ + spliceOptions(index, deleteCount, ...options) { + const normalizedOptions = normalizeArray(options); + const clone = [...this.options]; + clone.splice( + index, + deleteCount, + ...normalizedOptions.map( + (normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)) + ) + ); + optionsLengthValidator.parse(clone.length); + this.options.splice(0, this.options.length, ...clone); + return this; + } + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON() { + validateRequiredSelectMenuParameters(this.options, this.data.custom_id); + return { + ...this.data, + options: this.options.map((option) => option.toJSON()) + }; + } +}; + +// src/components/selectMenu/UserSelectMenu.ts +var import_v107 = require("discord-api-types/v10"); +var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "UserSelectMenuBuilder"); + } + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new UserSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new UserSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data) { + super({ ...data, type: import_v107.ComponentType.UserSelect }); + } + /** + * Adds default users to this auto populated select menu. + * + * @param users - The users to add + */ + addDefaultUsers(...users) { + const normalizedValues = normalizeArray(users); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: import_v107.SelectMenuDefaultValueType.User + })) + ); + return this; + } + /** + * Sets default users to this auto populated select menu. + * + * @param users - The users to set + */ + setDefaultUsers(...users) { + const normalizedValues = normalizeArray(users); + optionsLengthValidator.parse(normalizedValues.length); + this.data.default_values = normalizedValues.map((id) => ({ + id, + type: import_v107.SelectMenuDefaultValueType.User + })); + return this; + } +}; + +// src/components/textInput/TextInput.ts +var import_util = require("@discordjs/util"); +var import_v109 = require("discord-api-types/v10"); +var import_fast_deep_equal = __toESM(require("fast-deep-equal")); + +// src/components/textInput/Assertions.ts +var Assertions_exports3 = {}; +__export(Assertions_exports3, { + labelValidator: () => labelValidator, + maxLengthValidator: () => maxLengthValidator, + minLengthValidator: () => minLengthValidator, + placeholderValidator: () => placeholderValidator2, + requiredValidator: () => requiredValidator, + textInputStyleValidator: () => textInputStyleValidator, + validateRequiredParameters: () => validateRequiredParameters, + valueValidator: () => valueValidator +}); +var import_shapeshift3 = require("@sapphire/shapeshift"); +var import_v108 = require("discord-api-types/v10"); +var textInputStyleValidator = import_shapeshift3.s.nativeEnum(import_v108.TextInputStyle); +var minLengthValidator = import_shapeshift3.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled); +var maxLengthValidator = import_shapeshift3.s.number.int.greaterThanOrEqual(1).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled); +var requiredValidator = import_shapeshift3.s.boolean; +var valueValidator = import_shapeshift3.s.string.lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled); +var placeholderValidator2 = import_shapeshift3.s.string.lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled); +var labelValidator = import_shapeshift3.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled); +function validateRequiredParameters(customId, style, label) { + customIdValidator.parse(customId); + textInputStyleValidator.parse(style); + labelValidator.parse(label); +} +__name(validateRequiredParameters, "validateRequiredParameters"); + +// src/components/textInput/TextInput.ts +var TextInputBuilder = class extends ComponentBuilder { + static { + __name(this, "TextInputBuilder"); + } + /** + * Creates a new text input from API data. + * + * @param data - The API data to create this text input with + * @example + * Creating a select menu option from an API data object: + * ```ts + * const textInput = new TextInputBuilder({ + * custom_id: 'a cool select menu', + * label: 'Type something', + * style: TextInputStyle.Short, + * }); + * ``` + * @example + * Creating a select menu option using setters and API data: + * ```ts + * const textInput = new TextInputBuilder({ + * label: 'Type something else', + * }) + * .setCustomId('woah') + * .setStyle(TextInputStyle.Paragraph); + * ``` + */ + constructor(data) { + super({ type: import_v109.ComponentType.TextInput, ...data }); + } + /** + * Sets the custom id for this text input. + * + * @param customId - The custom id to use + */ + setCustomId(customId) { + this.data.custom_id = customIdValidator.parse(customId); + return this; + } + /** + * Sets the label for this text input. + * + * @param label - The label to use + */ + setLabel(label) { + this.data.label = labelValidator.parse(label); + return this; + } + /** + * Sets the style for this text input. + * + * @param style - The style to use + */ + setStyle(style) { + this.data.style = textInputStyleValidator.parse(style); + return this; + } + /** + * Sets the minimum length of text for this text input. + * + * @param minLength - The minimum length of text for this text input + */ + setMinLength(minLength) { + this.data.min_length = minLengthValidator.parse(minLength); + return this; + } + /** + * Sets the maximum length of text for this text input. + * + * @param maxLength - The maximum length of text for this text input + */ + setMaxLength(maxLength) { + this.data.max_length = maxLengthValidator.parse(maxLength); + return this; + } + /** + * Sets the placeholder for this text input. + * + * @param placeholder - The placeholder to use + */ + setPlaceholder(placeholder) { + this.data.placeholder = placeholderValidator2.parse(placeholder); + return this; + } + /** + * Sets the value for this text input. + * + * @param value - The value to use + */ + setValue(value) { + this.data.value = valueValidator.parse(value); + return this; + } + /** + * Sets whether this text input is required. + * + * @param required - Whether this text input is required + */ + setRequired(required = true) { + this.data.required = requiredValidator.parse(required); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + validateRequiredParameters(this.data.custom_id, this.data.style, this.data.label); + return { + ...this.data + }; + } + /** + * {@inheritDoc Equatable.equals} + */ + equals(other) { + if ((0, import_util.isJSONEncodable)(other)) { + return (0, import_fast_deep_equal.default)(other.toJSON(), this.data); + } + return (0, import_fast_deep_equal.default)(other, this.data); + } +}; + +// src/components/Components.ts +function createComponentBuilder(data) { + if (data instanceof ComponentBuilder) { + return data; + } + switch (data.type) { + case import_v1010.ComponentType.ActionRow: + return new ActionRowBuilder(data); + case import_v1010.ComponentType.Button: + return new ButtonBuilder(data); + case import_v1010.ComponentType.StringSelect: + return new StringSelectMenuBuilder(data); + case import_v1010.ComponentType.TextInput: + return new TextInputBuilder(data); + case import_v1010.ComponentType.UserSelect: + return new UserSelectMenuBuilder(data); + case import_v1010.ComponentType.RoleSelect: + return new RoleSelectMenuBuilder(data); + case import_v1010.ComponentType.MentionableSelect: + return new MentionableSelectMenuBuilder(data); + case import_v1010.ComponentType.ChannelSelect: + return new ChannelSelectMenuBuilder(data); + default: + throw new Error(`Cannot properly serialize component type: ${data.type}`); + } +} +__name(createComponentBuilder, "createComponentBuilder"); + +// src/components/ActionRow.ts +var ActionRowBuilder = class extends ComponentBuilder { + static { + __name(this, "ActionRowBuilder"); + } + /** + * The components within this action row. + */ + components; + /** + * Creates a new action row from API data. + * + * @param data - The API data to create this action row with + * @example + * Creating an action row from an API data object: + * ```ts + * const actionRow = new ActionRowBuilder({ + * components: [ + * { + * custom_id: "custom id", + * label: "Type something", + * style: TextInputStyle.Short, + * type: ComponentType.TextInput, + * }, + * ], + * }); + * ``` + * @example + * Creating an action row using setters and API data: + * ```ts + * const actionRow = new ActionRowBuilder({ + * components: [ + * { + * custom_id: "custom id", + * label: "Click me", + * style: ButtonStyle.Primary, + * type: ComponentType.Button, + * }, + * ], + * }) + * .addComponents(button2, button3); + * ``` + */ + constructor({ components, ...data } = {}) { + super({ type: import_v1011.ComponentType.ActionRow, ...data }); + this.components = components?.map((component) => createComponentBuilder(component)) ?? []; + } + /** + * Adds components to this action row. + * + * @param components - The components to add + */ + addComponents(...components) { + this.components.push(...normalizeArray(components)); + return this; + } + /** + * Sets components for this action row. + * + * @param components - The components to set + */ + setComponents(...components) { + this.components.splice(0, this.components.length, ...normalizeArray(components)); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + return { + ...this.data, + components: this.components.map((component) => component.toJSON()) + }; + } +}; + +// src/interactions/modals/Assertions.ts +var Assertions_exports4 = {}; +__export(Assertions_exports4, { + componentsValidator: () => componentsValidator, + titleValidator: () => titleValidator, + validateRequiredParameters: () => validateRequiredParameters2 +}); +var import_shapeshift4 = require("@sapphire/shapeshift"); +var titleValidator = import_shapeshift4.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled); +var componentsValidator = import_shapeshift4.s.instance(ActionRowBuilder).array.lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled); +function validateRequiredParameters2(customId, title, components) { + customIdValidator.parse(customId); + titleValidator.parse(title); + componentsValidator.parse(components); +} +__name(validateRequiredParameters2, "validateRequiredParameters"); + +// src/interactions/modals/Modal.ts +var ModalBuilder = class { + static { + __name(this, "ModalBuilder"); + } + /** + * The API data associated with this modal. + */ + data; + /** + * The components within this modal. + */ + components = []; + /** + * Creates a new modal from API data. + * + * @param data - The API data to create this modal with + */ + constructor({ components, ...data } = {}) { + this.data = { ...data }; + this.components = components?.map((component) => createComponentBuilder(component)) ?? []; + } + /** + * Sets the title of this modal. + * + * @param title - The title to use + */ + setTitle(title) { + this.data.title = titleValidator.parse(title); + return this; + } + /** + * Sets the custom id of this modal. + * + * @param customId - The custom id to use + */ + setCustomId(customId) { + this.data.custom_id = customIdValidator.parse(customId); + return this; + } + /** + * Adds components to this modal. + * + * @param components - The components to add + */ + addComponents(...components) { + this.components.push( + ...normalizeArray(components).map( + (component) => component instanceof ActionRowBuilder ? component : new ActionRowBuilder(component) + ) + ); + return this; + } + /** + * Sets components for this modal. + * + * @param components - The components to set + */ + setComponents(...components) { + this.components.splice(0, this.components.length, ...normalizeArray(components)); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + validateRequiredParameters2(this.data.custom_id, this.data.title, this.components); + return { + ...this.data, + components: this.components.map((component) => component.toJSON()) + }; + } +}; + +// src/interactions/slashCommands/Assertions.ts +var Assertions_exports5 = {}; +__export(Assertions_exports5, { + assertReturnOfBuilder: () => assertReturnOfBuilder, + localizationMapPredicate: () => localizationMapPredicate, + validateChoicesLength: () => validateChoicesLength, + validateDMPermission: () => validateDMPermission, + validateDefaultMemberPermissions: () => validateDefaultMemberPermissions, + validateDefaultPermission: () => validateDefaultPermission, + validateDescription: () => validateDescription, + validateLocale: () => validateLocale, + validateLocalizationMap: () => validateLocalizationMap, + validateMaxOptionsLength: () => validateMaxOptionsLength, + validateNSFW: () => validateNSFW, + validateName: () => validateName, + validateRequired: () => validateRequired, + validateRequiredParameters: () => validateRequiredParameters3 +}); +var import_shapeshift5 = require("@sapphire/shapeshift"); +var import_v1012 = require("discord-api-types/v10"); +var namePredicate = import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u).setValidationEnabled(isValidationEnabled); +function validateName(name) { + namePredicate.parse(name); +} +__name(validateName, "validateName"); +var descriptionPredicate2 = import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled); +var localePredicate = import_shapeshift5.s.nativeEnum(import_v1012.Locale); +function validateDescription(description) { + descriptionPredicate2.parse(description); +} +__name(validateDescription, "validateDescription"); +var maxArrayLengthPredicate = import_shapeshift5.s.unknown.array.lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +function validateLocale(locale) { + return localePredicate.parse(locale); +} +__name(validateLocale, "validateLocale"); +function validateMaxOptionsLength(options) { + maxArrayLengthPredicate.parse(options); +} +__name(validateMaxOptionsLength, "validateMaxOptionsLength"); +function validateRequiredParameters3(name, description, options) { + validateName(name); + validateDescription(description); + validateMaxOptionsLength(options); +} +__name(validateRequiredParameters3, "validateRequiredParameters"); +var booleanPredicate = import_shapeshift5.s.boolean; +function validateDefaultPermission(value) { + booleanPredicate.parse(value); +} +__name(validateDefaultPermission, "validateDefaultPermission"); +function validateRequired(required) { + booleanPredicate.parse(required); +} +__name(validateRequired, "validateRequired"); +var choicesLengthPredicate = import_shapeshift5.s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +function validateChoicesLength(amountAdding, choices) { + choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding); +} +__name(validateChoicesLength, "validateChoicesLength"); +function assertReturnOfBuilder(input, ExpectedInstanceOf) { + import_shapeshift5.s.instance(ExpectedInstanceOf).parse(input); +} +__name(assertReturnOfBuilder, "assertReturnOfBuilder"); +var localizationMapPredicate = import_shapeshift5.s.object(Object.fromEntries(Object.values(import_v1012.Locale).map((locale) => [locale, import_shapeshift5.s.string.nullish]))).strict.nullish.setValidationEnabled(isValidationEnabled); +function validateLocalizationMap(value) { + localizationMapPredicate.parse(value); +} +__name(validateLocalizationMap, "validateLocalizationMap"); +var dmPermissionPredicate = import_shapeshift5.s.boolean.nullish; +function validateDMPermission(value) { + dmPermissionPredicate.parse(value); +} +__name(validateDMPermission, "validateDMPermission"); +var memberPermissionPredicate = import_shapeshift5.s.union( + import_shapeshift5.s.bigint.transform((value) => value.toString()), + import_shapeshift5.s.number.safeInt.transform((value) => value.toString()), + import_shapeshift5.s.string.regex(/^\d+$/) +).nullish; +function validateDefaultMemberPermissions(permissions) { + return memberPermissionPredicate.parse(permissions); +} +__name(validateDefaultMemberPermissions, "validateDefaultMemberPermissions"); +function validateNSFW(value) { + booleanPredicate.parse(value); +} +__name(validateNSFW, "validateNSFW"); + +// src/interactions/slashCommands/SlashCommandBuilder.ts +var import_ts_mixer6 = require("ts-mixer"); + +// src/interactions/slashCommands/SlashCommandSubcommands.ts +var import_v1024 = require("discord-api-types/v10"); +var import_ts_mixer5 = require("ts-mixer"); + +// src/interactions/slashCommands/mixins/NameAndDescription.ts +var SharedNameAndDescription = class { + static { + __name(this, "SharedNameAndDescription"); + } + /** + * The name of this command. + */ + name; + /** + * The name localizations of this command. + */ + name_localizations; + /** + * The description of this command. + */ + description; + /** + * The description localizations of this command. + */ + description_localizations; + /** + * Sets the name of this command. + * + * @param name - The name to use + */ + setName(name) { + validateName(name); + Reflect.set(this, "name", name); + return this; + } + /** + * Sets the description of this command. + * + * @param description - The description to use + */ + setDescription(description) { + validateDescription(description); + Reflect.set(this, "description", description); + return this; + } + /** + * Sets a name localization for this command. + * + * @param locale - The locale to set + * @param localizedName - The localized name for the given `locale` + */ + setNameLocalization(locale, localizedName) { + if (!this.name_localizations) { + Reflect.set(this, "name_localizations", {}); + } + const parsedLocale = validateLocale(locale); + if (localizedName === null) { + this.name_localizations[parsedLocale] = null; + return this; + } + validateName(localizedName); + this.name_localizations[parsedLocale] = localizedName; + return this; + } + /** + * Sets the name localizations for this command. + * + * @param localizedNames - The object of localized names to set + */ + setNameLocalizations(localizedNames) { + if (localizedNames === null) { + Reflect.set(this, "name_localizations", null); + return this; + } + Reflect.set(this, "name_localizations", {}); + for (const args of Object.entries(localizedNames)) { + this.setNameLocalization(...args); + } + return this; + } + /** + * Sets a description localization for this command. + * + * @param locale - The locale to set + * @param localizedDescription - The localized description for the given locale + */ + setDescriptionLocalization(locale, localizedDescription) { + if (!this.description_localizations) { + Reflect.set(this, "description_localizations", {}); + } + const parsedLocale = validateLocale(locale); + if (localizedDescription === null) { + this.description_localizations[parsedLocale] = null; + return this; + } + validateDescription(localizedDescription); + this.description_localizations[parsedLocale] = localizedDescription; + return this; + } + /** + * Sets the description localizations for this command. + * + * @param localizedDescriptions - The object of localized descriptions to set + */ + setDescriptionLocalizations(localizedDescriptions) { + if (localizedDescriptions === null) { + Reflect.set(this, "description_localizations", null); + return this; + } + Reflect.set(this, "description_localizations", {}); + for (const args of Object.entries(localizedDescriptions)) { + this.setDescriptionLocalization(...args); + } + return this; + } +}; + +// src/interactions/slashCommands/options/attachment.ts +var import_v1013 = require("discord-api-types/v10"); + +// src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts +var ApplicationCommandOptionBase = class extends SharedNameAndDescription { + static { + __name(this, "ApplicationCommandOptionBase"); + } + /** + * Whether this option is required. + * + * @defaultValue `false` + */ + required = false; + /** + * Sets whether this option is required. + * + * @param required - Whether this option should be required + */ + setRequired(required) { + validateRequired(required); + Reflect.set(this, "required", required); + return this; + } + /** + * This method runs required validators on this builder. + */ + runRequiredValidations() { + validateRequiredParameters3(this.name, this.description, []); + validateLocalizationMap(this.name_localizations); + validateLocalizationMap(this.description_localizations); + validateRequired(this.required); + } +}; + +// src/interactions/slashCommands/options/attachment.ts +var SlashCommandAttachmentOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandAttachmentOption"); + } + /** + * The type of this option. + */ + type = import_v1013.ApplicationCommandOptionType.Attachment; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/options/boolean.ts +var import_v1014 = require("discord-api-types/v10"); +var SlashCommandBooleanOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandBooleanOption"); + } + /** + * The type of this option. + */ + type = import_v1014.ApplicationCommandOptionType.Boolean; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/options/channel.ts +var import_v1016 = require("discord-api-types/v10"); +var import_ts_mixer = require("ts-mixer"); + +// src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts +var import_shapeshift6 = require("@sapphire/shapeshift"); +var import_v1015 = require("discord-api-types/v10"); +var allowedChannelTypes = [ + import_v1015.ChannelType.GuildText, + import_v1015.ChannelType.GuildVoice, + import_v1015.ChannelType.GuildCategory, + import_v1015.ChannelType.GuildAnnouncement, + import_v1015.ChannelType.AnnouncementThread, + import_v1015.ChannelType.PublicThread, + import_v1015.ChannelType.PrivateThread, + import_v1015.ChannelType.GuildStageVoice, + import_v1015.ChannelType.GuildForum, + import_v1015.ChannelType.GuildMedia +]; +var channelTypesPredicate = import_shapeshift6.s.array(import_shapeshift6.s.union(...allowedChannelTypes.map((type) => import_shapeshift6.s.literal(type)))); +var ApplicationCommandOptionChannelTypesMixin = class { + static { + __name(this, "ApplicationCommandOptionChannelTypesMixin"); + } + /** + * The channel types of this option. + */ + channel_types; + /** + * Adds channel types to this option. + * + * @param channelTypes - The channel types + */ + addChannelTypes(...channelTypes) { + if (this.channel_types === void 0) { + Reflect.set(this, "channel_types", []); + } + this.channel_types.push(...channelTypesPredicate.parse(channelTypes)); + return this; + } +}; + +// src/interactions/slashCommands/options/channel.ts +var SlashCommandChannelOption = class extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + type = import_v1016.ApplicationCommandOptionType.Channel; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; +__name(SlashCommandChannelOption, "SlashCommandChannelOption"); +SlashCommandChannelOption = __decorateClass([ + (0, import_ts_mixer.mix)(ApplicationCommandOptionChannelTypesMixin) +], SlashCommandChannelOption); + +// src/interactions/slashCommands/options/integer.ts +var import_shapeshift8 = require("@sapphire/shapeshift"); +var import_v1018 = require("discord-api-types/v10"); +var import_ts_mixer2 = require("ts-mixer"); + +// src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts +var ApplicationCommandNumericOptionMinMaxValueMixin = class { + static { + __name(this, "ApplicationCommandNumericOptionMinMaxValueMixin"); + } + /** + * The maximum value of this option. + */ + max_value; + /** + * The minimum value of this option. + */ + min_value; +}; + +// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts +var import_shapeshift7 = require("@sapphire/shapeshift"); +var import_v1017 = require("discord-api-types/v10"); +var stringPredicate = import_shapeshift7.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100); +var numberPredicate = import_shapeshift7.s.number.greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY); +var choicesPredicate = import_shapeshift7.s.object({ + name: stringPredicate, + name_localizations: localizationMapPredicate, + value: import_shapeshift7.s.union(stringPredicate, numberPredicate) +}).array; +var booleanPredicate2 = import_shapeshift7.s.boolean; +var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class { + static { + __name(this, "ApplicationCommandOptionWithChoicesAndAutocompleteMixin"); + } + /** + * The choices of this option. + */ + choices; + /** + * Whether this option utilizes autocomplete. + */ + autocomplete; + /** + * The type of this option. + * + * @privateRemarks Since this is present and this is a mixin, this is needed. + */ + type; + /** + * Adds multiple choices to this option. + * + * @param choices - The choices to add + */ + addChoices(...choices) { + if (choices.length > 0 && this.autocomplete) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + choicesPredicate.parse(choices); + if (this.choices === void 0) { + Reflect.set(this, "choices", []); + } + validateChoicesLength(choices.length, this.choices); + for (const { name, name_localizations, value } of choices) { + if (this.type === import_v1017.ApplicationCommandOptionType.String) { + stringPredicate.parse(value); + } else { + numberPredicate.parse(value); + } + this.choices.push({ name, name_localizations, value }); + } + return this; + } + /** + * Sets multiple choices for this option. + * + * @param choices - The choices to set + */ + setChoices(...choices) { + if (choices.length > 0 && this.autocomplete) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + choicesPredicate.parse(choices); + Reflect.set(this, "choices", []); + this.addChoices(...choices); + return this; + } + /** + * Whether this option uses autocomplete. + * + * @param autocomplete - Whether this option should use autocomplete + */ + setAutocomplete(autocomplete) { + booleanPredicate2.parse(autocomplete); + if (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + Reflect.set(this, "autocomplete", autocomplete); + return this; + } +}; + +// src/interactions/slashCommands/options/integer.ts +var numberValidator = import_shapeshift8.s.number.int; +var SlashCommandIntegerOption = class extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + type = import_v1018.ApplicationCommandOptionType.Integer; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue} + */ + setMaxValue(max) { + numberValidator.parse(max); + Reflect.set(this, "max_value", max); + return this; + } + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue} + */ + setMinValue(min) { + numberValidator.parse(min); + Reflect.set(this, "min_value", min); + return this; + } + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + return { ...this }; + } +}; +__name(SlashCommandIntegerOption, "SlashCommandIntegerOption"); +SlashCommandIntegerOption = __decorateClass([ + (0, import_ts_mixer2.mix)(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin) +], SlashCommandIntegerOption); + +// src/interactions/slashCommands/options/mentionable.ts +var import_v1019 = require("discord-api-types/v10"); +var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandMentionableOption"); + } + /** + * The type of this option. + */ + type = import_v1019.ApplicationCommandOptionType.Mentionable; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/options/number.ts +var import_shapeshift9 = require("@sapphire/shapeshift"); +var import_v1020 = require("discord-api-types/v10"); +var import_ts_mixer3 = require("ts-mixer"); +var numberValidator2 = import_shapeshift9.s.number; +var SlashCommandNumberOption = class extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + type = import_v1020.ApplicationCommandOptionType.Number; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue} + */ + setMaxValue(max) { + numberValidator2.parse(max); + Reflect.set(this, "max_value", max); + return this; + } + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue} + */ + setMinValue(min) { + numberValidator2.parse(min); + Reflect.set(this, "min_value", min); + return this; + } + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + return { ...this }; + } +}; +__name(SlashCommandNumberOption, "SlashCommandNumberOption"); +SlashCommandNumberOption = __decorateClass([ + (0, import_ts_mixer3.mix)(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin) +], SlashCommandNumberOption); + +// src/interactions/slashCommands/options/role.ts +var import_v1021 = require("discord-api-types/v10"); +var SlashCommandRoleOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandRoleOption"); + } + /** + * The type of this option. + */ + type = import_v1021.ApplicationCommandOptionType.Role; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/options/string.ts +var import_shapeshift10 = require("@sapphire/shapeshift"); +var import_v1022 = require("discord-api-types/v10"); +var import_ts_mixer4 = require("ts-mixer"); +var minLengthValidator2 = import_shapeshift10.s.number.greaterThanOrEqual(0).lessThanOrEqual(6e3); +var maxLengthValidator2 = import_shapeshift10.s.number.greaterThanOrEqual(1).lessThanOrEqual(6e3); +var SlashCommandStringOption = class extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + type = import_v1022.ApplicationCommandOptionType.String; + /** + * The maximum length of this option. + */ + max_length; + /** + * The minimum length of this option. + */ + min_length; + /** + * Sets the maximum length of this string option. + * + * @param max - The maximum length this option can be + */ + setMaxLength(max) { + maxLengthValidator2.parse(max); + Reflect.set(this, "max_length", max); + return this; + } + /** + * Sets the minimum length of this string option. + * + * @param min - The minimum length this option can be + */ + setMinLength(min) { + minLengthValidator2.parse(min); + Reflect.set(this, "min_length", min); + return this; + } + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + return { ...this }; + } +}; +__name(SlashCommandStringOption, "SlashCommandStringOption"); +SlashCommandStringOption = __decorateClass([ + (0, import_ts_mixer4.mix)(ApplicationCommandOptionWithChoicesAndAutocompleteMixin) +], SlashCommandStringOption); + +// src/interactions/slashCommands/options/user.ts +var import_v1023 = require("discord-api-types/v10"); +var SlashCommandUserOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandUserOption"); + } + /** + * The type of this option. + */ + type = import_v1023.ApplicationCommandOptionType.User; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/mixins/SharedSlashCommandOptions.ts +var SharedSlashCommandOptions = class { + static { + __name(this, "SharedSlashCommandOptions"); + } + options; + /** + * Adds a boolean option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addBooleanOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandBooleanOption); + } + /** + * Adds a user option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addUserOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandUserOption); + } + /** + * Adds a channel option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addChannelOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandChannelOption); + } + /** + * Adds a role option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addRoleOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandRoleOption); + } + /** + * Adds an attachment option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addAttachmentOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandAttachmentOption); + } + /** + * Adds a mentionable option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addMentionableOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandMentionableOption); + } + /** + * Adds a string option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addStringOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandStringOption); + } + /** + * Adds an integer option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addIntegerOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandIntegerOption); + } + /** + * Adds a number option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addNumberOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandNumberOption); + } + /** + * Where the actual adding magic happens. ✨ + * + * @param input - The input. What else? + * @param Instance - The instance of whatever is being added + * @internal + */ + _sharedAddOptionMethod(input, Instance) { + const { options } = this; + validateMaxOptionsLength(options); + const result = typeof input === "function" ? input(new Instance()) : input; + assertReturnOfBuilder(result, Instance); + options.push(result); + return this; + } +}; + +// src/interactions/slashCommands/SlashCommandSubcommands.ts +var SlashCommandSubcommandGroupBuilder = class { + /** + * The name of this subcommand group. + */ + name = void 0; + /** + * The description of this subcommand group. + */ + description = void 0; + /** + * The subcommands within this subcommand group. + */ + options = []; + /** + * Adds a new subcommand to this group. + * + * @param input - A function that returns a subcommand builder or an already built builder + */ + addSubcommand(input) { + const { options } = this; + validateMaxOptionsLength(options); + const result = typeof input === "function" ? input(new SlashCommandSubcommandBuilder()) : input; + assertReturnOfBuilder(result, SlashCommandSubcommandBuilder); + options.push(result); + return this; + } + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + validateRequiredParameters3(this.name, this.description, this.options); + return { + type: import_v1024.ApplicationCommandOptionType.SubcommandGroup, + name: this.name, + name_localizations: this.name_localizations, + description: this.description, + description_localizations: this.description_localizations, + options: this.options.map((option) => option.toJSON()) + }; + } +}; +__name(SlashCommandSubcommandGroupBuilder, "SlashCommandSubcommandGroupBuilder"); +SlashCommandSubcommandGroupBuilder = __decorateClass([ + (0, import_ts_mixer5.mix)(SharedNameAndDescription) +], SlashCommandSubcommandGroupBuilder); +var SlashCommandSubcommandBuilder = class { + /** + * The name of this subcommand. + */ + name = void 0; + /** + * The description of this subcommand. + */ + description = void 0; + /** + * The options within this subcommand. + */ + options = []; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + validateRequiredParameters3(this.name, this.description, this.options); + return { + type: import_v1024.ApplicationCommandOptionType.Subcommand, + name: this.name, + name_localizations: this.name_localizations, + description: this.description, + description_localizations: this.description_localizations, + options: this.options.map((option) => option.toJSON()) + }; + } +}; +__name(SlashCommandSubcommandBuilder, "SlashCommandSubcommandBuilder"); +SlashCommandSubcommandBuilder = __decorateClass([ + (0, import_ts_mixer5.mix)(SharedNameAndDescription, SharedSlashCommandOptions) +], SlashCommandSubcommandBuilder); + +// src/interactions/slashCommands/SlashCommandBuilder.ts +var SlashCommandBuilder = class { + /** + * The name of this command. + */ + name = void 0; + /** + * The name localizations of this command. + */ + name_localizations; + /** + * The description of this command. + */ + description = void 0; + /** + * The description localizations of this command. + */ + description_localizations; + /** + * The options of this command. + */ + options = []; + /** + * Whether this command is enabled by default when the application is added to a guild. + * + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + default_permission = void 0; + /** + * The set of permissions represented as a bit set for the command. + */ + default_member_permissions = void 0; + /** + * Indicates whether the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This property is only for global commands. + */ + dm_permission = void 0; + /** + * Whether this command is NSFW. + */ + nsfw = void 0; + /** + * Sets whether the command is enabled by default when the application is added to a guild. + * + * @remarks + * If set to `false`, you will have to later `PUT` the permissions for this command. + * @param value - Whether or not to enable this command by default + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + * @deprecated Use {@link SlashCommandBuilder.setDefaultMemberPermissions} or {@link SlashCommandBuilder.setDMPermission} instead. + */ + setDefaultPermission(value) { + validateDefaultPermission(value); + Reflect.set(this, "default_permission", value); + return this; + } + /** + * Sets the default permissions a member should have in order to run the command. + * + * @remarks + * You can set this to `'0'` to disable the command by default. + * @param permissions - The permissions bit field to set + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDefaultMemberPermissions(permissions) { + const permissionValue = validateDefaultMemberPermissions(permissions); + Reflect.set(this, "default_member_permissions", permissionValue); + return this; + } + /** + * Sets if the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This method is only for global commands. + * @param enabled - Whether the command should be enabled in direct messages + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDMPermission(enabled) { + validateDMPermission(enabled); + Reflect.set(this, "dm_permission", enabled); + return this; + } + /** + * Sets whether this command is NSFW. + * + * @param nsfw - Whether this command is NSFW + */ + setNSFW(nsfw = true) { + validateNSFW(nsfw); + Reflect.set(this, "nsfw", nsfw); + return this; + } + /** + * 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; + validateMaxOptionsLength(options); + const result = typeof input === "function" ? input(new SlashCommandSubcommandGroupBuilder()) : input; + assertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder); + options.push(result); + return this; + } + /** + * Adds a new subcommand to this command. + * + * @param input - A function that returns a subcommand builder or an already built builder + */ + addSubcommand(input) { + const { options } = this; + validateMaxOptionsLength(options); + const result = typeof input === "function" ? input(new SlashCommandSubcommandBuilder()) : input; + assertReturnOfBuilder(result, SlashCommandSubcommandBuilder); + options.push(result); + return this; + } + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + validateRequiredParameters3(this.name, this.description, this.options); + validateLocalizationMap(this.name_localizations); + validateLocalizationMap(this.description_localizations); + return { + ...this, + options: this.options.map((option) => option.toJSON()) + }; + } +}; +__name(SlashCommandBuilder, "SlashCommandBuilder"); +SlashCommandBuilder = __decorateClass([ + (0, import_ts_mixer6.mix)(SharedSlashCommandOptions, SharedNameAndDescription) +], SlashCommandBuilder); + +// src/interactions/contextMenuCommands/Assertions.ts +var Assertions_exports6 = {}; +__export(Assertions_exports6, { + validateDMPermission: () => validateDMPermission2, + validateDefaultMemberPermissions: () => validateDefaultMemberPermissions2, + validateDefaultPermission: () => validateDefaultPermission2, + validateName: () => validateName2, + validateRequiredParameters: () => validateRequiredParameters4, + validateType: () => validateType +}); +var import_shapeshift11 = require("@sapphire/shapeshift"); +var import_v1025 = require("discord-api-types/v10"); +var namePredicate2 = import_shapeshift11.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^( *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}]+ *)+$/u).setValidationEnabled(isValidationEnabled); +var typePredicate = import_shapeshift11.s.union(import_shapeshift11.s.literal(import_v1025.ApplicationCommandType.User), import_shapeshift11.s.literal(import_v1025.ApplicationCommandType.Message)).setValidationEnabled(isValidationEnabled); +var booleanPredicate3 = import_shapeshift11.s.boolean; +function validateDefaultPermission2(value) { + booleanPredicate3.parse(value); +} +__name(validateDefaultPermission2, "validateDefaultPermission"); +function validateName2(name) { + namePredicate2.parse(name); +} +__name(validateName2, "validateName"); +function validateType(type) { + typePredicate.parse(type); +} +__name(validateType, "validateType"); +function validateRequiredParameters4(name, type) { + validateName2(name); + validateType(type); +} +__name(validateRequiredParameters4, "validateRequiredParameters"); +var dmPermissionPredicate2 = import_shapeshift11.s.boolean.nullish; +function validateDMPermission2(value) { + dmPermissionPredicate2.parse(value); +} +__name(validateDMPermission2, "validateDMPermission"); +var memberPermissionPredicate2 = import_shapeshift11.s.union( + import_shapeshift11.s.bigint.transform((value) => value.toString()), + import_shapeshift11.s.number.safeInt.transform((value) => value.toString()), + import_shapeshift11.s.string.regex(/^\d+$/) +).nullish; +function validateDefaultMemberPermissions2(permissions) { + return memberPermissionPredicate2.parse(permissions); +} +__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions"); + +// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts +var ContextMenuCommandBuilder = class { + static { + __name(this, "ContextMenuCommandBuilder"); + } + /** + * The name of this command. + */ + name = void 0; + /** + * The name localizations of this command. + */ + name_localizations; + /** + * The type of this command. + */ + type = void 0; + /** + * Whether this command is enabled by default when the application is added to a guild. + * + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + default_permission = void 0; + /** + * The set of permissions represented as a bit set for the command. + */ + default_member_permissions = void 0; + /** + * Indicates whether the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This property is only for global commands. + */ + dm_permission = void 0; + /** + * Sets the name of this command. + * + * @param name - The name to use + */ + setName(name) { + validateName2(name); + Reflect.set(this, "name", name); + return this; + } + /** + * Sets the type of this command. + * + * @param type - The type to use + */ + setType(type) { + validateType(type); + Reflect.set(this, "type", type); + return this; + } + /** + * Sets whether the command is enabled by default when the application is added to a guild. + * + * @remarks + * If set to `false`, you will have to later `PUT` the permissions for this command. + * @param value - Whether to enable this command by default + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + setDefaultPermission(value) { + validateDefaultPermission2(value); + Reflect.set(this, "default_permission", value); + return this; + } + /** + * Sets the default permissions a member should have in order to run this command. + * + * @remarks + * You can set this to `'0'` to disable the command by default. + * @param permissions - The permissions bit field to set + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDefaultMemberPermissions(permissions) { + const permissionValue = validateDefaultMemberPermissions2(permissions); + Reflect.set(this, "default_member_permissions", permissionValue); + return this; + } + /** + * Sets if the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This method is only for global commands. + * @param enabled - Whether the command should be enabled in direct messages + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDMPermission(enabled) { + validateDMPermission2(enabled); + Reflect.set(this, "dm_permission", enabled); + return this; + } + /** + * Sets a name localization for this command. + * + * @param locale - The locale to set + * @param localizedName - The localized name for the given `locale` + */ + setNameLocalization(locale, localizedName) { + if (!this.name_localizations) { + Reflect.set(this, "name_localizations", {}); + } + const parsedLocale = validateLocale(locale); + if (localizedName === null) { + this.name_localizations[parsedLocale] = null; + return this; + } + validateName2(localizedName); + this.name_localizations[parsedLocale] = localizedName; + return this; + } + /** + * Sets the name localizations for this command. + * + * @param localizedNames - The object of localized names to set + */ + setNameLocalizations(localizedNames) { + if (localizedNames === null) { + Reflect.set(this, "name_localizations", null); + return this; + } + Reflect.set(this, "name_localizations", {}); + for (const args of Object.entries(localizedNames)) + this.setNameLocalization(...args); + return this; + } + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + validateRequiredParameters4(this.name, this.type); + validateLocalizationMap(this.name_localizations); + return { ...this }; + } +}; + +// src/util/componentUtil.ts +function embedLength(data) { + return (data.title?.length ?? 0) + (data.description?.length ?? 0) + (data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) + (data.footer?.text.length ?? 0) + (data.author?.name.length ?? 0); +} +__name(embedLength, "embedLength"); + +// src/index.ts +var version = "1.7.0"; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + ActionRowBuilder, + ApplicationCommandNumericOptionMinMaxValueMixin, + ApplicationCommandOptionBase, + ApplicationCommandOptionChannelTypesMixin, + ApplicationCommandOptionWithChoicesAndAutocompleteMixin, + BaseSelectMenuBuilder, + ButtonBuilder, + ChannelSelectMenuBuilder, + ComponentAssertions, + ComponentBuilder, + ContextMenuCommandAssertions, + ContextMenuCommandBuilder, + EmbedAssertions, + EmbedBuilder, + MentionableSelectMenuBuilder, + ModalAssertions, + ModalBuilder, + RoleSelectMenuBuilder, + SelectMenuBuilder, + SelectMenuOptionBuilder, + SharedNameAndDescription, + SharedSlashCommandOptions, + SlashCommandAssertions, + SlashCommandAttachmentOption, + SlashCommandBooleanOption, + SlashCommandBuilder, + SlashCommandChannelOption, + SlashCommandIntegerOption, + SlashCommandMentionableOption, + SlashCommandNumberOption, + SlashCommandRoleOption, + SlashCommandStringOption, + SlashCommandSubcommandBuilder, + SlashCommandSubcommandGroupBuilder, + SlashCommandUserOption, + StringSelectMenuBuilder, + StringSelectMenuOptionBuilder, + TextInputAssertions, + TextInputBuilder, + UserSelectMenuBuilder, + createComponentBuilder, + disableValidators, + embedLength, + enableValidators, + isValidationEnabled, + normalizeArray, + version, + ...require("@discordjs/formatters") +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@discordjs/builders/dist/index.js.map b/node_modules/@discordjs/builders/dist/index.js.map new file mode 100644 index 0000000..e452c66 --- /dev/null +++ b/node_modules/@discordjs/builders/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.ts","../src/messages/embed/Assertions.ts","../src/util/validation.ts","../src/util/normalizeArray.ts","../src/messages/embed/Embed.ts","../src/components/Assertions.ts","../src/components/selectMenu/StringSelectMenuOption.ts","../src/components/ActionRow.ts","../src/components/Component.ts","../src/components/Components.ts","../src/components/button/Button.ts","../src/components/selectMenu/ChannelSelectMenu.ts","../src/components/selectMenu/BaseSelectMenu.ts","../src/components/selectMenu/MentionableSelectMenu.ts","../src/components/selectMenu/RoleSelectMenu.ts","../src/components/selectMenu/StringSelectMenu.ts","../src/components/selectMenu/UserSelectMenu.ts","../src/components/textInput/TextInput.ts","../src/components/textInput/Assertions.ts","../src/interactions/modals/Assertions.ts","../src/interactions/modals/Modal.ts","../src/interactions/slashCommands/Assertions.ts","../src/interactions/slashCommands/SlashCommandBuilder.ts","../src/interactions/slashCommands/SlashCommandSubcommands.ts","../src/interactions/slashCommands/mixins/NameAndDescription.ts","../src/interactions/slashCommands/options/attachment.ts","../src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts","../src/interactions/slashCommands/options/boolean.ts","../src/interactions/slashCommands/options/channel.ts","../src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts","../src/interactions/slashCommands/options/integer.ts","../src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts","../src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts","../src/interactions/slashCommands/options/mentionable.ts","../src/interactions/slashCommands/options/number.ts","../src/interactions/slashCommands/options/role.ts","../src/interactions/slashCommands/options/string.ts","../src/interactions/slashCommands/options/user.ts","../src/interactions/slashCommands/mixins/SharedSlashCommandOptions.ts","../src/interactions/contextMenuCommands/Assertions.ts","../src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts","../src/util/componentUtil.ts"],"sourcesContent":["export * as EmbedAssertions from './messages/embed/Assertions.js';\nexport * from './messages/embed/Embed.js';\n// TODO: Consider removing this dep in the next major version\nexport * from '@discordjs/formatters';\n\nexport * as ComponentAssertions from './components/Assertions.js';\nexport * from './components/ActionRow.js';\nexport * from './components/button/Button.js';\nexport * from './components/Component.js';\nexport * from './components/Components.js';\nexport * from './components/textInput/TextInput.js';\nexport * as TextInputAssertions from './components/textInput/Assertions.js';\nexport * from './interactions/modals/Modal.js';\nexport * as ModalAssertions from './interactions/modals/Assertions.js';\n\nexport * from './components/selectMenu/BaseSelectMenu.js';\nexport * from './components/selectMenu/ChannelSelectMenu.js';\nexport * from './components/selectMenu/MentionableSelectMenu.js';\nexport * from './components/selectMenu/RoleSelectMenu.js';\nexport * from './components/selectMenu/StringSelectMenu.js';\n// TODO: Remove those aliases in v2\nexport {\n\t/**\n\t * @deprecated Will be removed in the next major version, use {@link StringSelectMenuBuilder} instead.\n\t */\n\tStringSelectMenuBuilder as SelectMenuBuilder,\n} from './components/selectMenu/StringSelectMenu.js';\nexport {\n\t/**\n\t * @deprecated Will be removed in the next major version, use {@link StringSelectMenuOptionBuilder} instead.\n\t */\n\tStringSelectMenuOptionBuilder as SelectMenuOptionBuilder,\n} from './components/selectMenu/StringSelectMenuOption.js';\nexport * from './components/selectMenu/StringSelectMenuOption.js';\nexport * from './components/selectMenu/UserSelectMenu.js';\n\nexport * as SlashCommandAssertions from './interactions/slashCommands/Assertions.js';\nexport * from './interactions/slashCommands/SlashCommandBuilder.js';\nexport * from './interactions/slashCommands/SlashCommandSubcommands.js';\nexport * from './interactions/slashCommands/options/boolean.js';\nexport * from './interactions/slashCommands/options/channel.js';\nexport * from './interactions/slashCommands/options/integer.js';\nexport * from './interactions/slashCommands/options/mentionable.js';\nexport * from './interactions/slashCommands/options/number.js';\nexport * from './interactions/slashCommands/options/role.js';\nexport * from './interactions/slashCommands/options/attachment.js';\nexport * from './interactions/slashCommands/options/string.js';\nexport * from './interactions/slashCommands/options/user.js';\nexport * from './interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.js';\nexport * from './interactions/slashCommands/mixins/ApplicationCommandOptionBase.js';\nexport * from './interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.js';\nexport * from './interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.js';\nexport * from './interactions/slashCommands/mixins/NameAndDescription.js';\nexport * from './interactions/slashCommands/mixins/SharedSlashCommandOptions.js';\n\nexport * as ContextMenuCommandAssertions from './interactions/contextMenuCommands/Assertions.js';\nexport * from './interactions/contextMenuCommands/ContextMenuCommandBuilder.js';\n\nexport * from './util/componentUtil.js';\nexport * from './util/normalizeArray.js';\nexport * from './util/validation.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/builders#readme | @discordjs/builders} version\n * that you are currently using.\n *\n * @privateRemarks This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild.\n */\nexport const version = '1.7.0' as string;\n","import { s } from '@sapphire/shapeshift';\nimport type { APIEmbedField } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../../util/validation.js';\n\nexport const fieldNamePredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(256)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const fieldValuePredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(1_024)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const fieldInlinePredicate = s.boolean.optional;\n\nexport const embedFieldPredicate = s\n\t.object({\n\t\tname: fieldNamePredicate,\n\t\tvalue: fieldValuePredicate,\n\t\tinline: fieldInlinePredicate,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const embedFieldsArrayPredicate = embedFieldPredicate.array.setValidationEnabled(isValidationEnabled);\n\nexport const fieldLengthPredicate = s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);\n\nexport function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void {\n\tfieldLengthPredicate.parse((fields?.length ?? 0) + amountAdding);\n}\n\nexport const authorNamePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);\n\nexport const imageURLPredicate = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:', 'attachment:'],\n\t})\n\t.nullish.setValidationEnabled(isValidationEnabled);\n\nexport const urlPredicate = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:'],\n\t})\n\t.nullish.setValidationEnabled(isValidationEnabled);\n\nexport const embedAuthorPredicate = s\n\t.object({\n\t\tname: authorNamePredicate,\n\t\ticonURL: imageURLPredicate,\n\t\turl: urlPredicate,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const RGBPredicate = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(255)\n\t.setValidationEnabled(isValidationEnabled);\nexport const colorPredicate = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(0xffffff)\n\t.or(s.tuple([RGBPredicate, RGBPredicate, RGBPredicate]))\n\t.nullable.setValidationEnabled(isValidationEnabled);\n\nexport const descriptionPredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(4_096)\n\t.nullable.setValidationEnabled(isValidationEnabled);\n\nexport const footerTextPredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(2_048)\n\t.nullable.setValidationEnabled(isValidationEnabled);\n\nexport const embedFooterPredicate = s\n\t.object({\n\t\ttext: footerTextPredicate,\n\t\ticonURL: imageURLPredicate,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const timestampPredicate = s.union(s.number, s.date).nullable.setValidationEnabled(isValidationEnabled);\n\nexport const titlePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);\n","let validate = true;\n\n/**\n * Enables validators.\n *\n * @returns Whether validation is occurring.\n */\nexport function enableValidators() {\n\treturn (validate = true);\n}\n\n/**\n * Disables validators.\n *\n * @returns Whether validation is occurring.\n */\nexport function disableValidators() {\n\treturn (validate = false);\n}\n\n/**\n * Checks whether validation is occurring.\n */\nexport function isValidationEnabled() {\n\treturn validate;\n}\n","/**\n * Normalizes data that is a rest parameter or an array into an array with a depth of 1.\n *\n * @typeParam ItemType - The data that must satisfy {@link RestOrArray}.\n * @param arr - The (possibly variadic) data to normalize\n */\nexport function normalizeArray(arr: RestOrArray): ItemType[] {\n\tif (Array.isArray(arr[0])) return arr[0];\n\treturn arr as ItemType[];\n}\n\n/**\n * Represents data that may be an array or came from a rest parameter.\n *\n * @remarks\n * This type is used throughout builders to ensure both an array and variadic arguments\n * may be used. It is normalized with {@link normalizeArray}.\n */\nexport type RestOrArray = Type[] | [Type[]];\n","import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage } from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray.js';\nimport {\n\tcolorPredicate,\n\tdescriptionPredicate,\n\tembedAuthorPredicate,\n\tembedFieldsArrayPredicate,\n\tembedFooterPredicate,\n\timageURLPredicate,\n\ttimestampPredicate,\n\ttitlePredicate,\n\turlPredicate,\n\tvalidateFieldLength,\n} from './Assertions.js';\n\n/**\n * A tuple satisfying the RGB color model.\n *\n * @see {@link https://developer.mozilla.org/docs/Glossary/RGB}\n */\nexport type RGBTuple = [red: number, green: number, blue: number];\n\n/**\n * The base icon data typically used in payloads.\n */\nexport interface IconData {\n\t/**\n\t * The URL of the icon.\n\t */\n\ticonURL?: string;\n\t/**\n\t * The proxy URL of the icon.\n\t */\n\tproxyIconURL?: string;\n}\n\n/**\n * Represents the author data of an embed.\n */\nexport type EmbedAuthorData = IconData & Omit;\n\n/**\n * Represents the author options of an embed.\n */\nexport type EmbedAuthorOptions = Omit;\n\n/**\n * Represents the footer data of an embed.\n */\nexport type EmbedFooterData = IconData & Omit;\n\n/**\n * Represents the footer options of an embed.\n */\nexport type EmbedFooterOptions = Omit;\n\n/**\n * Represents the image data of an embed.\n */\nexport interface EmbedImageData extends Omit {\n\t/**\n\t * The proxy URL for the image.\n\t */\n\tproxyURL?: string;\n}\n\n/**\n * A builder that creates API-compatible JSON data for embeds.\n */\nexport class EmbedBuilder {\n\t/**\n\t * The API data associated with this embed.\n\t */\n\tpublic readonly data: APIEmbed;\n\n\t/**\n\t * Creates a new embed from API data.\n\t *\n\t * @param data - The API data to create this embed with\n\t */\n\tpublic constructor(data: APIEmbed = {}) {\n\t\tthis.data = { ...data };\n\t\tif (data.timestamp) this.data.timestamp = new Date(data.timestamp).toISOString();\n\t}\n\n\t/**\n\t * Appends fields to the embed.\n\t *\n\t * @remarks\n\t * This method accepts either an array of fields or a variable number of field parameters.\n\t * The maximum amount of fields that can be added is 25.\n\t * @example\n\t * Using an array:\n\t * ```ts\n\t * const fields: APIEmbedField[] = ...;\n\t * const embed = new EmbedBuilder()\n\t * \t.addFields(fields);\n\t * ```\n\t * @example\n\t * Using rest parameters (variadic):\n\t * ```ts\n\t * const embed = new EmbedBuilder()\n\t * \t.addFields(\n\t * \t\t{ name: 'Field 1', value: 'Value 1' },\n\t * \t\t{ name: 'Field 2', value: 'Value 2' },\n\t * \t);\n\t * ```\n\t * @param fields - The fields to add\n\t */\n\tpublic addFields(...fields: RestOrArray): this {\n\t\tconst normalizedFields = normalizeArray(fields);\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(normalizedFields.length, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(normalizedFields);\n\n\t\tif (this.data.fields) this.data.fields.push(...normalizedFields);\n\t\telse this.data.fields = normalizedFields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts fields for this embed.\n\t *\n\t * @remarks\n\t * This method behaves similarly\n\t * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.\n\t * The maximum amount of fields that can be added is 25.\n\t *\n\t * It's useful for modifying and adjusting order of the already-existing fields of an embed.\n\t * @example\n\t * Remove the first field:\n\t * ```ts\n\t * embed.spliceFields(0, 1);\n\t * ```\n\t * @example\n\t * Remove the first n fields:\n\t * ```ts\n\t * const n = 4;\n\t * embed.spliceFields(0, n);\n\t * ```\n\t * @example\n\t * Remove the last field:\n\t * ```ts\n\t * embed.spliceFields(-1, 1);\n\t * ```\n\t * @param index - The index to start at\n\t * @param deleteCount - The number of fields to remove\n\t * @param fields - The replacing field objects\n\t */\n\tpublic spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this {\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length - deleteCount, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\t\tif (this.data.fields) this.data.fields.splice(index, deleteCount, ...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the fields for this embed.\n\t *\n\t * @remarks\n\t * This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically,\n\t * it splices the entire array of fields, replacing them with the provided fields.\n\t *\n\t * You can set a maximum of 25 fields.\n\t * @param fields - The fields to set\n\t */\n\tpublic setFields(...fields: RestOrArray) {\n\t\tthis.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the author of this embed.\n\t *\n\t * @param options - The options to use\n\t */\n\n\tpublic setAuthor(options: EmbedAuthorOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.author = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedAuthorPredicate.parse(options);\n\n\t\tthis.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the color of this embed.\n\t *\n\t * @param color - The color to use\n\t */\n\tpublic setColor(color: RGBTuple | number | null): this {\n\t\t// Data assertions\n\t\tcolorPredicate.parse(color);\n\n\t\tif (Array.isArray(color)) {\n\t\t\tconst [red, green, blue] = color;\n\t\t\tthis.data.color = (red << 16) + (green << 8) + blue;\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.data.color = color ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this embed.\n\t *\n\t * @param description - The description to use\n\t */\n\tpublic setDescription(description: string | null): this {\n\t\t// Data assertions\n\t\tdescriptionPredicate.parse(description);\n\n\t\tthis.data.description = description ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the footer of this embed.\n\t *\n\t * @param options - The footer to use\n\t */\n\tpublic setFooter(options: EmbedFooterOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.footer = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedFooterPredicate.parse(options);\n\n\t\tthis.data.footer = { text: options.text, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the image of this embed.\n\t *\n\t * @param url - The image URL to use\n\t */\n\tpublic setImage(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.image = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the thumbnail of this embed.\n\t *\n\t * @param url - The thumbnail URL to use\n\t */\n\tpublic setThumbnail(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.thumbnail = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the timestamp of this embed.\n\t *\n\t * @param timestamp - The timestamp or date to use\n\t */\n\tpublic setTimestamp(timestamp: Date | number | null = Date.now()): this {\n\t\t// Data assertions\n\t\ttimestampPredicate.parse(timestamp);\n\n\t\tthis.data.timestamp = timestamp ? new Date(timestamp).toISOString() : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the title for this embed.\n\t *\n\t * @param title - The title to use\n\t */\n\tpublic setTitle(title: string | null): this {\n\t\t// Data assertions\n\t\ttitlePredicate.parse(title);\n\n\t\tthis.data.title = title ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL of this embed.\n\t *\n\t * @param url - The URL to use\n\t */\n\tpublic setURL(url: string | null): this {\n\t\t// Data assertions\n\t\turlPredicate.parse(url);\n\n\t\tthis.data.url = url ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): APIEmbed {\n\t\treturn { ...this.data };\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ButtonStyle, ChannelType, type APIMessageComponentEmoji } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../util/validation.js';\nimport { StringSelectMenuOptionBuilder } from './selectMenu/StringSelectMenuOption.js';\n\nexport const customIdValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const emojiValidator = s\n\t.object({\n\t\tid: s.string,\n\t\tname: s.string,\n\t\tanimated: s.boolean,\n\t})\n\t.partial.strict.setValidationEnabled(isValidationEnabled);\n\nexport const disabledValidator = s.boolean;\n\nexport const buttonLabelValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(80)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const buttonStyleValidator = s.nativeEnum(ButtonStyle);\n\nexport const placeholderValidator = s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);\nexport const minMaxValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const labelValueDescriptionValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const jsonOptionValidator = s\n\t.object({\n\t\tlabel: labelValueDescriptionValidator,\n\t\tvalue: labelValueDescriptionValidator,\n\t\tdescription: labelValueDescriptionValidator.optional,\n\t\temoji: emojiValidator.optional,\n\t\tdefault: s.boolean.optional,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const optionValidator = s.instance(StringSelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);\n\nexport const optionsValidator = optionValidator.array\n\t.lengthGreaterThanOrEqual(0)\n\t.setValidationEnabled(isValidationEnabled);\nexport const optionsLengthValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredSelectMenuParameters(options: StringSelectMenuOptionBuilder[], customId?: string) {\n\tcustomIdValidator.parse(customId);\n\toptionsValidator.parse(options);\n}\n\nexport const defaultValidator = s.boolean;\n\nexport function validateRequiredSelectMenuOptionParameters(label?: string, value?: string) {\n\tlabelValueDescriptionValidator.parse(label);\n\tlabelValueDescriptionValidator.parse(value);\n}\n\nexport const channelTypesValidator = s.nativeEnum(ChannelType).array.setValidationEnabled(isValidationEnabled);\n\nexport const urlValidator = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:', 'discord:'],\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredButtonParameters(\n\tstyle?: ButtonStyle,\n\tlabel?: string,\n\temoji?: APIMessageComponentEmoji,\n\tcustomId?: string,\n\turl?: string,\n) {\n\tif (url && customId) {\n\t\tthrow new RangeError('URL and custom id are mutually exclusive');\n\t}\n\n\tif (!label && !emoji) {\n\t\tthrow new RangeError('Buttons must have a label and/or an emoji');\n\t}\n\n\tif (style === ButtonStyle.Link) {\n\t\tif (!url) {\n\t\t\tthrow new RangeError('Link buttons must have a url');\n\t\t}\n\t} else if (url) {\n\t\tthrow new RangeError('Non-link buttons cannot have a url');\n\t}\n}\n","import type { JSONEncodable } from '@discordjs/util';\nimport type { APIMessageComponentEmoji, APISelectMenuOption } from 'discord-api-types/v10';\nimport {\n\tdefaultValidator,\n\temojiValidator,\n\tlabelValueDescriptionValidator,\n\tvalidateRequiredSelectMenuOptionParameters,\n} from '../Assertions.js';\n\n/**\n * A builder that creates API-compatible JSON data for string select menu options.\n */\nexport class StringSelectMenuOptionBuilder implements JSONEncodable {\n\t/**\n\t * Creates a new string select menu option from API data.\n\t *\n\t * @param data - The API data to create this string select menu option with\n\t * @example\n\t * Creating a string select menu option from an API data object:\n\t * ```ts\n\t * const selectMenuOption = new SelectMenuOptionBuilder({\n\t * \tlabel: 'catchy label',\n\t * \tvalue: '1',\n\t * });\n\t * ```\n\t * @example\n\t * Creating a string select menu option using setters and API data:\n\t * ```ts\n\t * const selectMenuOption = new SelectMenuOptionBuilder({\n\t * \tdefault: true,\n\t * \tvalue: '1',\n\t * })\n\t * \t.setLabel('woah');\n\t * ```\n\t */\n\tpublic constructor(public data: Partial = {}) {}\n\n\t/**\n\t * Sets the label for this option.\n\t *\n\t * @param label - The label to use\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValueDescriptionValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value for this option.\n\t *\n\t * @param value - The value to use\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = labelValueDescriptionValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description for this option.\n\t *\n\t * @param description - The description to use\n\t */\n\tpublic setDescription(description: string) {\n\t\tthis.data.description = labelValueDescriptionValidator.parse(description);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this option is selected by default.\n\t *\n\t * @param isDefault - Whether this option is selected by default\n\t */\n\tpublic setDefault(isDefault = true) {\n\t\tthis.data.default = defaultValidator.parse(isDefault);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display for this option.\n\t *\n\t * @param emoji - The emoji to use\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc BaseSelectMenuBuilder.toJSON}\n\t */\n\tpublic toJSON(): APISelectMenuOption {\n\t\tvalidateRequiredSelectMenuOptionParameters(this.data.label, this.data.value);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APISelectMenuOption;\n\t}\n}\n","/* eslint-disable jsdoc/check-param-names */\n\nimport {\n\ttype APIActionRowComponent,\n\tComponentType,\n\ttype APIMessageActionRowComponent,\n\ttype APIModalActionRowComponent,\n\ttype APIActionRowComponentTypes,\n} from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../util/normalizeArray.js';\nimport { ComponentBuilder } from './Component.js';\nimport { createComponentBuilder } from './Components.js';\nimport type { ButtonBuilder } from './button/Button.js';\nimport type { ChannelSelectMenuBuilder } from './selectMenu/ChannelSelectMenu.js';\nimport type { MentionableSelectMenuBuilder } from './selectMenu/MentionableSelectMenu.js';\nimport type { RoleSelectMenuBuilder } from './selectMenu/RoleSelectMenu.js';\nimport type { StringSelectMenuBuilder } from './selectMenu/StringSelectMenu.js';\nimport type { UserSelectMenuBuilder } from './selectMenu/UserSelectMenu.js';\nimport type { TextInputBuilder } from './textInput/TextInput.js';\n\n/**\n * The builders that may be used for messages.\n */\nexport type MessageComponentBuilder =\n\t| ActionRowBuilder\n\t| MessageActionRowComponentBuilder;\n\n/**\n * The builders that may be used for modals.\n */\nexport type ModalComponentBuilder = ActionRowBuilder | ModalActionRowComponentBuilder;\n\n/**\n * The builders that may be used within an action row for messages.\n */\nexport type MessageActionRowComponentBuilder =\n\t| ButtonBuilder\n\t| ChannelSelectMenuBuilder\n\t| MentionableSelectMenuBuilder\n\t| RoleSelectMenuBuilder\n\t| StringSelectMenuBuilder\n\t| UserSelectMenuBuilder;\n\n/**\n * The builders that may be used within an action row for modals.\n */\nexport type ModalActionRowComponentBuilder = TextInputBuilder;\n\n/**\n * Any builder.\n */\nexport type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;\n\n/**\n * A builder that creates API-compatible JSON data for action rows.\n *\n * @typeParam ComponentType - The types of components this action row holds\n */\nexport class ActionRowBuilder extends ComponentBuilder<\n\tAPIActionRowComponent\n> {\n\t/**\n\t * The components within this action row.\n\t */\n\tpublic readonly components: ComponentType[];\n\n\t/**\n\t * Creates a new action row from API data.\n\t *\n\t * @param data - The API data to create this action row with\n\t * @example\n\t * Creating an action row from an API data object:\n\t * ```ts\n\t * const actionRow = new ActionRowBuilder({\n\t * \tcomponents: [\n\t * \t\t{\n\t * \t\t\tcustom_id: \"custom id\",\n\t * \t\t\tlabel: \"Type something\",\n\t * \t\t\tstyle: TextInputStyle.Short,\n\t * \t\t\ttype: ComponentType.TextInput,\n\t * \t\t},\n\t * \t],\n\t * });\n\t * ```\n\t * @example\n\t * Creating an action row using setters and API data:\n\t * ```ts\n\t * const actionRow = new ActionRowBuilder({\n\t * \tcomponents: [\n\t * \t\t{\n\t * \t\t\tcustom_id: \"custom id\",\n\t * \t\t\tlabel: \"Click me\",\n\t * \t\t\tstyle: ButtonStyle.Primary,\n\t * \t\t\ttype: ComponentType.Button,\n\t * \t\t},\n\t * \t],\n\t * })\n\t * \t.addComponents(button2, button3);\n\t * ```\n\t */\n\tpublic constructor({ components, ...data }: Partial> = {}) {\n\t\tsuper({ type: ComponentType.ActionRow, ...data });\n\t\tthis.components = (components?.map((component) => createComponentBuilder(component)) ?? []) as ComponentType[];\n\t}\n\n\t/**\n\t * Adds components to this action row.\n\t *\n\t * @param components - The components to add\n\t */\n\tpublic addComponents(...components: RestOrArray) {\n\t\tthis.components.push(...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets components for this action row.\n\t *\n\t * @param components - The components to set\n\t */\n\tpublic setComponents(...components: RestOrArray) {\n\t\tthis.components.splice(0, this.components.length, ...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APIActionRowComponent> {\n\t\treturn {\n\t\t\t...this.data,\n\t\t\tcomponents: this.components.map((component) => component.toJSON()),\n\t\t} as APIActionRowComponent>;\n\t}\n}\n","import type { JSONEncodable } from '@discordjs/util';\nimport type {\n\tAPIActionRowComponent,\n\tAPIActionRowComponentTypes,\n\tAPIBaseComponent,\n\tComponentType,\n} from 'discord-api-types/v10';\n\n/**\n * Any action row component data represented as an object.\n */\nexport type AnyAPIActionRowComponent = APIActionRowComponent | APIActionRowComponentTypes;\n\n/**\n * The base component builder that contains common symbols for all sorts of components.\n *\n * @typeParam DataType - The type of internal API data that is stored within the component\n */\nexport abstract class ComponentBuilder<\n\tDataType extends Partial> = APIBaseComponent,\n> implements JSONEncodable\n{\n\t/**\n\t * The API data associated with this component.\n\t */\n\tpublic readonly data: Partial;\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic abstract toJSON(): AnyAPIActionRowComponent;\n\n\t/**\n\t * Constructs a new kind of component.\n\t *\n\t * @param data - The data to construct a component out of\n\t */\n\tpublic constructor(data: Partial) {\n\t\tthis.data = data;\n\t}\n}\n","import { ComponentType, type APIMessageComponent, type APIModalComponent } from 'discord-api-types/v10';\nimport {\n\tActionRowBuilder,\n\ttype AnyComponentBuilder,\n\ttype MessageComponentBuilder,\n\ttype ModalComponentBuilder,\n} from './ActionRow.js';\nimport { ComponentBuilder } from './Component.js';\nimport { ButtonBuilder } from './button/Button.js';\nimport { ChannelSelectMenuBuilder } from './selectMenu/ChannelSelectMenu.js';\nimport { MentionableSelectMenuBuilder } from './selectMenu/MentionableSelectMenu.js';\nimport { RoleSelectMenuBuilder } from './selectMenu/RoleSelectMenu.js';\nimport { StringSelectMenuBuilder } from './selectMenu/StringSelectMenu.js';\nimport { UserSelectMenuBuilder } from './selectMenu/UserSelectMenu.js';\nimport { TextInputBuilder } from './textInput/TextInput.js';\n\n/**\n * Components here are mapped to their respective builder.\n */\nexport interface MappedComponentTypes {\n\t/**\n\t * The action row component type is associated with an {@link ActionRowBuilder}.\n\t */\n\t[ComponentType.ActionRow]: ActionRowBuilder;\n\t/**\n\t * The button component type is associated with an {@link ButtonBuilder}.\n\t */\n\t[ComponentType.Button]: ButtonBuilder;\n\t/**\n\t * The string select component type is associated with an {@link StringSelectMenuBuilder}.\n\t */\n\t[ComponentType.StringSelect]: StringSelectMenuBuilder;\n\t/**\n\t * The text inpiut component type is associated with an {@link TextInputBuilder}.\n\t */\n\t[ComponentType.TextInput]: TextInputBuilder;\n\t/**\n\t * The user select component type is associated with an {@link UserSelectMenuBuilder}.\n\t */\n\t[ComponentType.UserSelect]: UserSelectMenuBuilder;\n\t/**\n\t * The role select component type is associated with an {@link RoleSelectMenuBuilder}.\n\t */\n\t[ComponentType.RoleSelect]: RoleSelectMenuBuilder;\n\t/**\n\t * The mentionable select component type is associated with an {@link MentionableSelectMenuBuilder}.\n\t */\n\t[ComponentType.MentionableSelect]: MentionableSelectMenuBuilder;\n\t/**\n\t * The channel select component type is associated with an {@link ChannelSelectMenuBuilder}.\n\t */\n\t[ComponentType.ChannelSelect]: ChannelSelectMenuBuilder;\n}\n\n/**\n * Factory for creating components from API data.\n *\n * @typeParam ComponentType - The type of component to use\n * @param data - The API data to transform to a component class\n */\nexport function createComponentBuilder(\n\t// eslint-disable-next-line @typescript-eslint/sort-type-constituents\n\tdata: (APIModalComponent | APIMessageComponent) & { type: ComponentType },\n): MappedComponentTypes[ComponentType];\n\n/**\n * Factory for creating components from API data.\n *\n * @typeParam ComponentBuilder - The type of component to use\n * @param data - The API data to transform to a component class\n */\nexport function createComponentBuilder(\n\tdata: ComponentBuilder,\n): ComponentBuilder;\n\nexport function createComponentBuilder(\n\tdata: APIMessageComponent | APIModalComponent | MessageComponentBuilder,\n): ComponentBuilder {\n\tif (data instanceof ComponentBuilder) {\n\t\treturn data;\n\t}\n\n\tswitch (data.type) {\n\t\tcase ComponentType.ActionRow:\n\t\t\treturn new ActionRowBuilder(data);\n\t\tcase ComponentType.Button:\n\t\t\treturn new ButtonBuilder(data);\n\t\tcase ComponentType.StringSelect:\n\t\t\treturn new StringSelectMenuBuilder(data);\n\t\tcase ComponentType.TextInput:\n\t\t\treturn new TextInputBuilder(data);\n\t\tcase ComponentType.UserSelect:\n\t\t\treturn new UserSelectMenuBuilder(data);\n\t\tcase ComponentType.RoleSelect:\n\t\t\treturn new RoleSelectMenuBuilder(data);\n\t\tcase ComponentType.MentionableSelect:\n\t\t\treturn new MentionableSelectMenuBuilder(data);\n\t\tcase ComponentType.ChannelSelect:\n\t\t\treturn new ChannelSelectMenuBuilder(data);\n\t\tdefault:\n\t\t\t// @ts-expect-error This case can still occur if we get a newer unsupported component type\n\t\t\tthrow new Error(`Cannot properly serialize component type: ${data.type}`);\n\t}\n}\n","import {\n\tComponentType,\n\ttype APIMessageComponentEmoji,\n\ttype APIButtonComponent,\n\ttype APIButtonComponentWithURL,\n\ttype APIButtonComponentWithCustomId,\n\ttype ButtonStyle,\n} from 'discord-api-types/v10';\nimport {\n\tbuttonLabelValidator,\n\tbuttonStyleValidator,\n\tcustomIdValidator,\n\tdisabledValidator,\n\temojiValidator,\n\turlValidator,\n\tvalidateRequiredButtonParameters,\n} from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\n\n/**\n * A builder that creates API-compatible JSON data for buttons.\n */\nexport class ButtonBuilder extends ComponentBuilder {\n\t/**\n\t * Creates a new button from API data.\n\t *\n\t * @param data - The API data to create this button with\n\t * @example\n\t * Creating a button from an API data object:\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tcustom_id: 'a cool button',\n\t * \tstyle: ButtonStyle.Primary,\n\t * \tlabel: 'Click Me',\n\t * \temoji: {\n\t * \t\tname: 'smile',\n\t * \t\tid: '123456789012345678',\n\t * \t},\n\t * });\n\t * ```\n\t * @example\n\t * Creating a button using setters and API data:\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: ButtonStyle.Secondary,\n\t * \tlabel: 'Click Me',\n\t * })\n\t * \t.setEmoji({ name: '🙂' })\n\t * \t.setCustomId('another cool button');\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ type: ComponentType.Button, ...data });\n\t}\n\n\t/**\n\t * Sets the style of this button.\n\t *\n\t * @param style - The style to use\n\t */\n\tpublic setStyle(style: ButtonStyle) {\n\t\tthis.data.style = buttonStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL for this button.\n\t *\n\t * @remarks\n\t * This method is only available to buttons using the `Link` button style.\n\t * Only three types of URL schemes are currently supported: `https://`, `http://`, and `discord://`.\n\t * @param url - The URL to use\n\t */\n\tpublic setURL(url: string) {\n\t\t(this.data as APIButtonComponentWithURL).url = urlValidator.parse(url);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this button.\n\t *\n\t * @remarks\n\t * This method is only applicable to buttons that are not using the `Link` button style.\n\t * @param customId - The custom id to use\n\t */\n\tpublic setCustomId(customId: string) {\n\t\t(this.data as APIButtonComponentWithCustomId).custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this button.\n\t *\n\t * @param emoji - The emoji to use\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this button is disabled.\n\t *\n\t * @param disabled - Whether to disable this button\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this button.\n\t *\n\t * @param label - The label to use\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = buttonLabelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APIButtonComponent {\n\t\tvalidateRequiredButtonParameters(\n\t\t\tthis.data.style,\n\t\t\tthis.data.label,\n\t\t\tthis.data.emoji,\n\t\t\t(this.data as APIButtonComponentWithCustomId).custom_id,\n\t\t\t(this.data as APIButtonComponentWithURL).url,\n\t\t);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APIButtonComponent;\n\t}\n}\n","import {\n\ttype APIChannelSelectComponent,\n\ttype ChannelType,\n\ttype Snowflake,\n\tComponentType,\n\tSelectMenuDefaultValueType,\n} from 'discord-api-types/v10';\nimport { type RestOrArray, normalizeArray } from '../../util/normalizeArray.js';\nimport { channelTypesValidator, customIdValidator, optionsLengthValidator } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\n\n/**\n * A builder that creates API-compatible JSON data for channel select menus.\n */\nexport class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new ChannelSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new ChannelSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)\n\t * \t.setMinValues(2);\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ ...data, type: ComponentType.ChannelSelect });\n\t}\n\n\t/**\n\t * Adds channel types to this select menu.\n\t *\n\t * @param types - The channel types to use\n\t */\n\tpublic addChannelTypes(...types: RestOrArray) {\n\t\tconst normalizedTypes = normalizeArray(types);\n\t\tthis.data.channel_types ??= [];\n\t\tthis.data.channel_types.push(...channelTypesValidator.parse(normalizedTypes));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets channel types for this select menu.\n\t *\n\t * @param types - The channel types to use\n\t */\n\tpublic setChannelTypes(...types: RestOrArray) {\n\t\tconst normalizedTypes = normalizeArray(types);\n\t\tthis.data.channel_types ??= [];\n\t\tthis.data.channel_types.splice(0, this.data.channel_types.length, ...channelTypesValidator.parse(normalizedTypes));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds default channels to this auto populated select menu.\n\t *\n\t * @param channels - The channels to add\n\t */\n\tpublic addDefaultChannels(...channels: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(channels);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.Channel as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets default channels to this auto populated select menu.\n\t *\n\t * @param channels - The channels to set\n\t */\n\tpublic setDefaultChannels(...channels: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(channels);\n\t\toptionsLengthValidator.parse(normalizedValues.length);\n\n\t\tthis.data.default_values = normalizedValues.map((id) => ({\n\t\t\tid,\n\t\t\ttype: SelectMenuDefaultValueType.Channel as const,\n\t\t}));\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc BaseSelectMenuBuilder.toJSON}\n\t */\n\tpublic override toJSON(): APIChannelSelectComponent {\n\t\tcustomIdValidator.parse(this.data.custom_id);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APIChannelSelectComponent;\n\t}\n}\n","import type { APISelectMenuComponent } from 'discord-api-types/v10';\nimport { customIdValidator, disabledValidator, minMaxValidator, placeholderValidator } from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\n\n/**\n * The base select menu builder that contains common symbols for select menu builders.\n *\n * @typeParam SelectMenuType - The type of select menu this would be instantiated for.\n */\nexport abstract class BaseSelectMenuBuilder<\n\tSelectMenuType extends APISelectMenuComponent,\n> extends ComponentBuilder {\n\t/**\n\t * Sets the placeholder for this select menu.\n\t *\n\t * @param placeholder - The placeholder to use\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum values that must be selected in the select menu.\n\t *\n\t * @param minValues - The minimum values that must be selected\n\t */\n\tpublic setMinValues(minValues: number) {\n\t\tthis.data.min_values = minMaxValidator.parse(minValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum values that must be selected in the select menu.\n\t *\n\t * @param maxValues - The maximum values that must be selected\n\t */\n\tpublic setMaxValues(maxValues: number) {\n\t\tthis.data.max_values = minMaxValidator.parse(maxValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this select menu.\n\t *\n\t * @param customId - The custom id to use\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this select menu is disabled.\n\t *\n\t * @param disabled - Whether this select menu is disabled\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): SelectMenuType {\n\t\tcustomIdValidator.parse(this.data.custom_id);\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as SelectMenuType;\n\t}\n}\n","import {\n\ttype APIMentionableSelectComponent,\n\ttype APISelectMenuDefaultValue,\n\ttype Snowflake,\n\tComponentType,\n\tSelectMenuDefaultValueType,\n} from 'discord-api-types/v10';\nimport { type RestOrArray, normalizeArray } from '../../util/normalizeArray.js';\nimport { optionsLengthValidator } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\n\n/**\n * A builder that creates API-compatible JSON data for mentionable select menus.\n */\nexport class MentionableSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new MentionableSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new MentionableSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.setMinValues(1);\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ ...data, type: ComponentType.MentionableSelect });\n\t}\n\n\t/**\n\t * Adds default roles to this auto populated select menu.\n\t *\n\t * @param roles - The roles to add\n\t */\n\tpublic addDefaultRoles(...roles: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(roles);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.Role as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds default users to this auto populated select menu.\n\t *\n\t * @param users - The users to add\n\t */\n\tpublic addDefaultUsers(...users: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(users);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.User as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds default values to this auto populated select menu.\n\t *\n\t * @param values - The values to add\n\t */\n\tpublic addDefaultValues(\n\t\t...values: RestOrArray<\n\t\t\t| APISelectMenuDefaultValue\n\t\t\t| APISelectMenuDefaultValue\n\t\t>\n\t) {\n\t\tconst normalizedValues = normalizeArray(values);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\t\tthis.data.default_values.push(...normalizedValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets default values to this auto populated select menu.\n\t *\n\t * @param values - The values to set\n\t */\n\tpublic setDefaultValues(\n\t\t...values: RestOrArray<\n\t\t\t| APISelectMenuDefaultValue\n\t\t\t| APISelectMenuDefaultValue\n\t\t>\n\t) {\n\t\tconst normalizedValues = normalizeArray(values);\n\t\toptionsLengthValidator.parse(normalizedValues.length);\n\t\tthis.data.default_values = normalizedValues.slice();\n\t\treturn this;\n\t}\n}\n","import {\n\ttype APIRoleSelectComponent,\n\ttype Snowflake,\n\tComponentType,\n\tSelectMenuDefaultValueType,\n} from 'discord-api-types/v10';\nimport { type RestOrArray, normalizeArray } from '../../util/normalizeArray.js';\nimport { optionsLengthValidator } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\n\n/**\n * A builder that creates API-compatible JSON data for role select menus.\n */\nexport class RoleSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new RoleSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new RoleSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.setMinValues(1);\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ ...data, type: ComponentType.RoleSelect });\n\t}\n\n\t/**\n\t * Adds default roles to this auto populated select menu.\n\t *\n\t * @param roles - The roles to add\n\t */\n\tpublic addDefaultRoles(...roles: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(roles);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.Role as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets default roles to this auto populated select menu.\n\t *\n\t * @param roles - The roles to set\n\t */\n\tpublic setDefaultRoles(...roles: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(roles);\n\t\toptionsLengthValidator.parse(normalizedValues.length);\n\n\t\tthis.data.default_values = normalizedValues.map((id) => ({\n\t\t\tid,\n\t\t\ttype: SelectMenuDefaultValueType.Role as const,\n\t\t}));\n\n\t\treturn this;\n\t}\n}\n","import { ComponentType } from 'discord-api-types/v10';\nimport type { APIStringSelectComponent, APISelectMenuOption } from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray.js';\nimport { jsonOptionValidator, optionsLengthValidator, validateRequiredSelectMenuParameters } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\nimport { StringSelectMenuOptionBuilder } from './StringSelectMenuOption.js';\n\n/**\n * A builder that creates API-compatible JSON data for string select menus.\n */\nexport class StringSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * The options within this select menu.\n\t */\n\tpublic readonly options: StringSelectMenuOptionBuilder[];\n\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new StringSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * \toptions: [\n\t * \t\t{ label: 'option 1', value: '1' },\n\t * \t\t{ label: 'option 2', value: '2' },\n\t * \t\t{ label: 'option 3', value: '3' },\n\t * \t],\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new StringSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.setMinValues(1)\n\t * \t.addOptions({\n\t * \t\tlabel: 'Catchy',\n\t * \t\tvalue: 'catch',\n\t * \t});\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tconst { options, ...initData } = data ?? {};\n\t\tsuper({ ...initData, type: ComponentType.StringSelect });\n\t\tthis.options = options?.map((option: APISelectMenuOption) => new StringSelectMenuOptionBuilder(option)) ?? [];\n\t}\n\n\t/**\n\t * Adds options to this select menu.\n\t *\n\t * @param options - The options to add\n\t */\n\tpublic addOptions(...options: RestOrArray) {\n\t\tconst normalizedOptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(this.options.length + normalizedOptions.length);\n\t\tthis.options.push(\n\t\t\t...normalizedOptions.map((normalizedOption) =>\n\t\t\t\tnormalizedOption instanceof StringSelectMenuOptionBuilder\n\t\t\t\t\t? normalizedOption\n\t\t\t\t\t: new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the options for this select menu.\n\t *\n\t * @param options - The options to set\n\t */\n\tpublic setOptions(...options: RestOrArray) {\n\t\treturn this.spliceOptions(0, this.options.length, ...options);\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts options for this select menu.\n\t *\n\t * @remarks\n\t * This method behaves similarly\n\t * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice()}.\n\t * It's useful for modifying and adjusting the order of existing options.\n\t * @example\n\t * Remove the first option:\n\t * ```ts\n\t * selectMenu.spliceOptions(0, 1);\n\t * ```\n\t * @example\n\t * Remove the first n option:\n\t * ```ts\n\t * const n = 4;\n\t * selectMenu.spliceOptions(0, n);\n\t * ```\n\t * @example\n\t * Remove the last option:\n\t * ```ts\n\t * selectMenu.spliceOptions(-1, 1);\n\t * ```\n\t * @param index - The index to start at\n\t * @param deleteCount - The number of options to remove\n\t * @param options - The replacing option objects or builders\n\t */\n\tpublic spliceOptions(\n\t\tindex: number,\n\t\tdeleteCount: number,\n\t\t...options: RestOrArray\n\t) {\n\t\tconst normalizedOptions = normalizeArray(options);\n\n\t\tconst clone = [...this.options];\n\n\t\tclone.splice(\n\t\t\tindex,\n\t\t\tdeleteCount,\n\t\t\t...normalizedOptions.map((normalizedOption) =>\n\t\t\t\tnormalizedOption instanceof StringSelectMenuOptionBuilder\n\t\t\t\t\t? normalizedOption\n\t\t\t\t\t: new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)),\n\t\t\t),\n\t\t);\n\n\t\toptionsLengthValidator.parse(clone.length);\n\t\tthis.options.splice(0, this.options.length, ...clone);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc BaseSelectMenuBuilder.toJSON}\n\t */\n\tpublic override toJSON(): APIStringSelectComponent {\n\t\tvalidateRequiredSelectMenuParameters(this.options, this.data.custom_id);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t} as APIStringSelectComponent;\n\t}\n}\n","import {\n\ttype APIUserSelectComponent,\n\ttype Snowflake,\n\tComponentType,\n\tSelectMenuDefaultValueType,\n} from 'discord-api-types/v10';\nimport { type RestOrArray, normalizeArray } from '../../util/normalizeArray.js';\nimport { optionsLengthValidator } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\n\n/**\n * A builder that creates API-compatible JSON data for user select menus.\n */\nexport class UserSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new UserSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new UserSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.setMinValues(1);\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ ...data, type: ComponentType.UserSelect });\n\t}\n\n\t/**\n\t * Adds default users to this auto populated select menu.\n\t *\n\t * @param users - The users to add\n\t */\n\tpublic addDefaultUsers(...users: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(users);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.User as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets default users to this auto populated select menu.\n\t *\n\t * @param users - The users to set\n\t */\n\tpublic setDefaultUsers(...users: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(users);\n\t\toptionsLengthValidator.parse(normalizedValues.length);\n\n\t\tthis.data.default_values = normalizedValues.map((id) => ({\n\t\t\tid,\n\t\t\ttype: SelectMenuDefaultValueType.User as const,\n\t\t}));\n\n\t\treturn this;\n\t}\n}\n","import { isJSONEncodable, type Equatable, type JSONEncodable } from '@discordjs/util';\nimport { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';\nimport isEqual from 'fast-deep-equal';\nimport { customIdValidator } from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\nimport {\n\tmaxLengthValidator,\n\tminLengthValidator,\n\tplaceholderValidator,\n\trequiredValidator,\n\tvalueValidator,\n\tvalidateRequiredParameters,\n\tlabelValidator,\n\ttextInputStyleValidator,\n} from './Assertions.js';\n\n/**\n * A builder that creates API-compatible JSON data for text inputs.\n */\nexport class TextInputBuilder\n\textends ComponentBuilder\n\timplements Equatable>\n{\n\t/**\n\t * Creates a new text input from API data.\n\t *\n\t * @param data - The API data to create this text input with\n\t * @example\n\t * Creating a select menu option from an API data object:\n\t * ```ts\n\t * const textInput = new TextInputBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tlabel: 'Type something',\n\t * \tstyle: TextInputStyle.Short,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu option using setters and API data:\n\t * ```ts\n\t * const textInput = new TextInputBuilder({\n\t * \tlabel: 'Type something else',\n\t * })\n\t * \t.setCustomId('woah')\n\t * \t.setStyle(TextInputStyle.Paragraph);\n\t * ```\n\t */\n\tpublic constructor(data?: APITextInputComponent & { type?: ComponentType.TextInput }) {\n\t\tsuper({ type: ComponentType.TextInput, ...data });\n\t}\n\n\t/**\n\t * Sets the custom id for this text input.\n\t *\n\t * @param customId - The custom id to use\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this text input.\n\t *\n\t * @param label - The label to use\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the style for this text input.\n\t *\n\t * @param style - The style to use\n\t */\n\tpublic setStyle(style: TextInputStyle) {\n\t\tthis.data.style = textInputStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum length of text for this text input.\n\t *\n\t * @param minLength - The minimum length of text for this text input\n\t */\n\tpublic setMinLength(minLength: number) {\n\t\tthis.data.min_length = minLengthValidator.parse(minLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum length of text for this text input.\n\t *\n\t * @param maxLength - The maximum length of text for this text input\n\t */\n\tpublic setMaxLength(maxLength: number) {\n\t\tthis.data.max_length = maxLengthValidator.parse(maxLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the placeholder for this text input.\n\t *\n\t * @param placeholder - The placeholder to use\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value for this text input.\n\t *\n\t * @param value - The value to use\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = valueValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this text input is required.\n\t *\n\t * @param required - Whether this text input is required\n\t */\n\tpublic setRequired(required = true) {\n\t\tthis.data.required = requiredValidator.parse(required);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APITextInputComponent {\n\t\tvalidateRequiredParameters(this.data.custom_id, this.data.style, this.data.label);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APITextInputComponent;\n\t}\n\n\t/**\n\t * {@inheritDoc Equatable.equals}\n\t */\n\tpublic equals(other: APITextInputComponent | JSONEncodable): boolean {\n\t\tif (isJSONEncodable(other)) {\n\t\t\treturn isEqual(other.toJSON(), this.data);\n\t\t}\n\n\t\treturn isEqual(other, this.data);\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { TextInputStyle } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../../util/validation.js';\nimport { customIdValidator } from '../Assertions.js';\n\nexport const textInputStyleValidator = s.nativeEnum(TextInputStyle);\nexport const minLengthValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(4_000)\n\t.setValidationEnabled(isValidationEnabled);\nexport const maxLengthValidator = s.number.int\n\t.greaterThanOrEqual(1)\n\t.lessThanOrEqual(4_000)\n\t.setValidationEnabled(isValidationEnabled);\nexport const requiredValidator = s.boolean;\nexport const valueValidator = s.string.lengthLessThanOrEqual(4_000).setValidationEnabled(isValidationEnabled);\nexport const placeholderValidator = s.string.lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);\nexport const labelValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(45)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredParameters(customId?: string, style?: TextInputStyle, label?: string) {\n\tcustomIdValidator.parse(customId);\n\ttextInputStyleValidator.parse(style);\n\tlabelValidator.parse(label);\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ActionRowBuilder, type ModalActionRowComponentBuilder } from '../../components/ActionRow.js';\nimport { customIdValidator } from '../../components/Assertions.js';\nimport { isValidationEnabled } from '../../util/validation.js';\n\nexport const titleValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(45)\n\t.setValidationEnabled(isValidationEnabled);\nexport const componentsValidator = s\n\t.instance(ActionRowBuilder)\n\t.array.lengthGreaterThanOrEqual(1)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredParameters(\n\tcustomId?: string,\n\ttitle?: string,\n\tcomponents?: ActionRowBuilder[],\n) {\n\tcustomIdValidator.parse(customId);\n\ttitleValidator.parse(title);\n\tcomponentsValidator.parse(components);\n}\n","/* eslint-disable jsdoc/check-param-names */\n\nimport type { JSONEncodable } from '@discordjs/util';\nimport type {\n\tAPIActionRowComponent,\n\tAPIModalActionRowComponent,\n\tAPIModalInteractionResponseCallbackData,\n} from 'discord-api-types/v10';\nimport { ActionRowBuilder, type ModalActionRowComponentBuilder } from '../../components/ActionRow.js';\nimport { customIdValidator } from '../../components/Assertions.js';\nimport { createComponentBuilder } from '../../components/Components.js';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray.js';\nimport { titleValidator, validateRequiredParameters } from './Assertions.js';\n\n/**\n * A builder that creates API-compatible JSON data for modals.\n */\nexport class ModalBuilder implements JSONEncodable {\n\t/**\n\t * The API data associated with this modal.\n\t */\n\tpublic readonly data: Partial;\n\n\t/**\n\t * The components within this modal.\n\t */\n\tpublic readonly components: ActionRowBuilder[] = [];\n\n\t/**\n\t * Creates a new modal from API data.\n\t *\n\t * @param data - The API data to create this modal with\n\t */\n\tpublic constructor({ components, ...data }: Partial = {}) {\n\t\tthis.data = { ...data };\n\t\tthis.components = (components?.map((component) => createComponentBuilder(component)) ??\n\t\t\t[]) as ActionRowBuilder[];\n\t}\n\n\t/**\n\t * Sets the title of this modal.\n\t *\n\t * @param title - The title to use\n\t */\n\tpublic setTitle(title: string) {\n\t\tthis.data.title = titleValidator.parse(title);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id of this modal.\n\t *\n\t * @param customId - The custom id to use\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds components to this modal.\n\t *\n\t * @param components - The components to add\n\t */\n\tpublic addComponents(\n\t\t...components: RestOrArray<\n\t\t\tActionRowBuilder | APIActionRowComponent\n\t\t>\n\t) {\n\t\tthis.components.push(\n\t\t\t...normalizeArray(components).map((component) =>\n\t\t\t\tcomponent instanceof ActionRowBuilder\n\t\t\t\t\t? component\n\t\t\t\t\t: new ActionRowBuilder(component),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets components for this modal.\n\t *\n\t * @param components - The components to set\n\t */\n\tpublic setComponents(...components: RestOrArray>) {\n\t\tthis.components.splice(0, this.components.length, ...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APIModalInteractionResponseCallbackData {\n\t\tvalidateRequiredParameters(this.data.custom_id, this.data.title, this.components);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t\tcomponents: this.components.map((component) => component.toJSON()),\n\t\t} as APIModalInteractionResponseCallbackData;\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { Locale, type APIApplicationCommandOptionChoice, type LocalizationMap } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../../util/validation.js';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder.js';\nimport type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands.js';\nimport type { ApplicationCommandOptionBase } from './mixins/ApplicationCommandOptionBase.js';\n\nconst namePredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(32)\n\t.regex(/^[\\p{Ll}\\p{Lm}\\p{Lo}\\p{N}\\p{sc=Devanagari}\\p{sc=Thai}_-]+$/u)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateName(name: unknown): asserts name is string {\n\tnamePredicate.parse(name);\n}\n\nconst descriptionPredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\nconst localePredicate = s.nativeEnum(Locale);\n\nexport function validateDescription(description: unknown): asserts description is string {\n\tdescriptionPredicate.parse(description);\n}\n\nconst maxArrayLengthPredicate = s.unknown.array.lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);\nexport function validateLocale(locale: unknown) {\n\treturn localePredicate.parse(locale);\n}\n\nexport function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[] {\n\tmaxArrayLengthPredicate.parse(options);\n}\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 booleanPredicate = s.boolean;\n\nexport function validateDefaultPermission(value: unknown): asserts value is boolean {\n\tbooleanPredicate.parse(value);\n}\n\nexport function validateRequired(required: unknown): asserts required is boolean {\n\tbooleanPredicate.parse(required);\n}\n\nconst choicesLengthPredicate = s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);\n\nexport function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void {\n\tchoicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);\n}\n\nexport function assertReturnOfBuilder<\n\tReturnType extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder,\n>(input: unknown, ExpectedInstanceOf: new () => ReturnType): asserts input is ReturnType {\n\ts.instance(ExpectedInstanceOf).parse(input);\n}\n\nexport const localizationMapPredicate = s\n\t.object(Object.fromEntries(Object.values(Locale).map((locale) => [locale, s.string.nullish])))\n\t.strict.nullish.setValidationEnabled(isValidationEnabled);\n\nexport function validateLocalizationMap(value: unknown): asserts value is LocalizationMap {\n\tlocalizationMapPredicate.parse(value);\n}\n\nconst dmPermissionPredicate = s.boolean.nullish;\n\nexport function validateDMPermission(value: unknown): asserts value is boolean | null | undefined {\n\tdmPermissionPredicate.parse(value);\n}\n\nconst memberPermissionPredicate = s.union(\n\ts.bigint.transform((value) => value.toString()),\n\ts.number.safeInt.transform((value) => value.toString()),\n\ts.string.regex(/^\\d+$/),\n).nullish;\n\nexport function validateDefaultMemberPermissions(permissions: unknown) {\n\treturn memberPermissionPredicate.parse(permissions);\n}\n\nexport function validateNSFW(value: unknown): asserts value is boolean {\n\tbooleanPredicate.parse(value);\n}\n","import type {\n\tAPIApplicationCommandOption,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIChatInputApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport {\n\tassertReturnOfBuilder,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDefaultPermission,\n\tvalidateLocalizationMap,\n\tvalidateDMPermission,\n\tvalidateMaxOptionsLength,\n\tvalidateRequiredParameters,\n\tvalidateNSFW,\n} from './Assertions.js';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands.js';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription.js';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions.js';\n\n/**\n * A builder that creates API-compatible JSON data for slash commands.\n */\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this command.\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The name localizations of this command.\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this command.\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The description localizations of this command.\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * The options of this command.\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Whether this command is enabled by default when the application is added to a guild.\n\t *\n\t * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead.\n\t */\n\tpublic readonly default_permission: boolean | undefined = undefined;\n\n\t/**\n\t * The set of permissions represented as a bit set for the command.\n\t */\n\tpublic readonly default_member_permissions: Permissions | null | undefined = undefined;\n\n\t/**\n\t * Indicates whether the command is available in direct messages with the application.\n\t *\n\t * @remarks\n\t * By default, commands are visible. This property is only for global commands.\n\t */\n\tpublic readonly dm_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Whether this command is NSFW.\n\t */\n\tpublic readonly nsfw: boolean | undefined = undefined;\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * @remarks\n\t * If set to `false`, you will have to later `PUT` the permissions for this command.\n\t * @param value - Whether or not to enable this command by default\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t * @deprecated Use {@link SlashCommandBuilder.setDefaultMemberPermissions} or {@link SlashCommandBuilder.setDMPermission} instead.\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'default_permission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the default permissions a member should have in order to run the command.\n\t *\n\t * @remarks\n\t * You can set this to `'0'` to disable the command by default.\n\t * @param permissions - The permissions bit field to set\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t */\n\tpublic setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined) {\n\t\t// Assert the value and parse it\n\t\tconst permissionValue = validateDefaultMemberPermissions(permissions);\n\n\t\tReflect.set(this, 'default_member_permissions', permissionValue);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets if the command is available in direct messages with the application.\n\t *\n\t * @remarks\n\t * By default, commands are visible. This method is only for global commands.\n\t * @param enabled - Whether the command should be enabled in direct messages\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t */\n\tpublic setDMPermission(enabled: boolean | null | undefined) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDMPermission(enabled);\n\n\t\tReflect.set(this, 'dm_permission', enabled);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this command is NSFW.\n\t *\n\t * @param nsfw - Whether this command is NSFW\n\t */\n\tpublic setNSFW(nsfw = true) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateNSFW(nsfw);\n\t\tReflect.set(this, 'nsfw', nsfw);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand group to this command.\n\t *\n\t * @param input - A function that returns a subcommand group builder or an already built builder\n\t */\n\tpublic addSubcommandGroup(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandGroupBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandGroupBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand to this command.\n\t *\n\t * @param input - A function that returns a subcommand builder or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): RESTPostAPIChatInputApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\treturn {\n\t\t\t...this,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n}\n\nexport interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n\n/**\n * An interface specifically for slash command subcommands.\n */\nexport interface SlashCommandSubcommandsOnlyBuilder\n\textends Omit> {}\n\n/**\n * An interface specifically for slash command options.\n */\nexport interface SlashCommandOptionsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tSharedSlashCommandOptions,\n\t\tPick {}\n\n/**\n * An interface that ensures the `toJSON()` call will return something\n * that can be serialized into API-compatible data.\n */\nexport interface ToAPIApplicationCommandOptions {\n\ttoJSON(): APIApplicationCommandOption;\n}\n","import {\n\tApplicationCommandOptionType,\n\ttype APIApplicationCommandSubcommandGroupOption,\n\ttype APIApplicationCommandSubcommandOption,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { assertReturnOfBuilder, validateMaxOptionsLength, validateRequiredParameters } from './Assertions.js';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder.js';\nimport type { ApplicationCommandOptionBase } from './mixins/ApplicationCommandOptionBase.js';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription.js';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions.js';\n\n/**\n * Represents a folder for subcommands.\n *\n * @see {@link https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups}\n */\n@mix(SharedNameAndDescription)\nexport class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {\n\t/**\n\t * The name of this subcommand group.\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this subcommand group.\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The subcommands within this subcommand group.\n\t */\n\tpublic readonly options: SlashCommandSubcommandBuilder[] = [];\n\n\t/**\n\t * Adds a new subcommand to this group.\n\t *\n\t * @param input - A function that returns a subcommand builder or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t) {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): APIApplicationCommandSubcommandGroupOption {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.SubcommandGroup,\n\t\t\tname: this.name,\n\t\t\tname_localizations: this.name_localizations,\n\t\t\tdescription: this.description,\n\t\t\tdescription_localizations: this.description_localizations,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n}\n\nexport interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {}\n\n/**\n * A builder that creates API-compatible JSON data for slash command subcommands.\n *\n * @see {@link https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups}\n */\n@mix(SharedNameAndDescription, SharedSlashCommandOptions)\nexport class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {\n\t/**\n\t * The name of this subcommand.\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this subcommand.\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The options within this subcommand.\n\t */\n\tpublic readonly options: ApplicationCommandOptionBase[] = [];\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): APIApplicationCommandSubcommandOption {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.Subcommand,\n\t\t\tname: this.name,\n\t\t\tname_localizations: this.name_localizations,\n\t\t\tdescription: this.description,\n\t\t\tdescription_localizations: this.description_localizations,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n}\n\nexport interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n","import type { LocaleString, LocalizationMap } from 'discord-api-types/v10';\nimport { validateDescription, validateLocale, validateName } from '../Assertions.js';\n\n/**\n * This mixin holds name and description symbols for slash commands.\n */\nexport class SharedNameAndDescription {\n\t/**\n\t * The name of this command.\n\t */\n\tpublic readonly name!: string;\n\n\t/**\n\t * The name localizations of this command.\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this command.\n\t */\n\tpublic readonly description!: string;\n\n\t/**\n\t * The description localizations of this command.\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * Sets the name of this command.\n\t *\n\t * @param name - The name to use\n\t */\n\tpublic setName(name: string): this {\n\t\t// Assert the name matches the conditions\n\t\tvalidateName(name);\n\n\t\tReflect.set(this, 'name', name);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this command.\n\t *\n\t * @param description - The description to use\n\t */\n\tpublic setDescription(description: string) {\n\t\t// Assert the description matches the conditions\n\t\tvalidateDescription(description);\n\n\t\tReflect.set(this, 'description', description);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a name localization for this command.\n\t *\n\t * @param locale - The locale to set\n\t * @param localizedName - The localized name for the given `locale`\n\t */\n\tpublic setNameLocalization(locale: LocaleString, localizedName: string | null) {\n\t\tif (!this.name_localizations) {\n\t\t\tReflect.set(this, 'name_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedName === null) {\n\t\t\tthis.name_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateName(localizedName);\n\n\t\tthis.name_localizations![parsedLocale] = localizedName;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the name localizations for this command.\n\t *\n\t * @param localizedNames - The object of localized names to set\n\t */\n\tpublic setNameLocalizations(localizedNames: LocalizationMap | null) {\n\t\tif (localizedNames === null) {\n\t\t\tReflect.set(this, 'name_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'name_localizations', {});\n\n\t\tfor (const args of Object.entries(localizedNames)) {\n\t\t\tthis.setNameLocalization(...(args as [LocaleString, string | null]));\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a description localization for this command.\n\t *\n\t * @param locale - The locale to set\n\t * @param localizedDescription - The localized description for the given locale\n\t */\n\tpublic setDescriptionLocalization(locale: LocaleString, localizedDescription: string | null) {\n\t\tif (!this.description_localizations) {\n\t\t\tReflect.set(this, 'description_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedDescription === null) {\n\t\t\tthis.description_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateDescription(localizedDescription);\n\n\t\tthis.description_localizations![parsedLocale] = localizedDescription;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description localizations for this command.\n\t *\n\t * @param localizedDescriptions - The object of localized descriptions to set\n\t */\n\tpublic setDescriptionLocalizations(localizedDescriptions: LocalizationMap | null) {\n\t\tif (localizedDescriptions === null) {\n\t\t\tReflect.set(this, 'description_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'description_localizations', {});\n\t\tfor (const args of Object.entries(localizedDescriptions)) {\n\t\t\tthis.setDescriptionLocalization(...(args as [LocaleString, string | null]));\n\t\t}\n\n\t\treturn this;\n\t}\n}\n","import { ApplicationCommandOptionType, type APIApplicationCommandAttachmentOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command attachment option.\n */\nexport class SlashCommandAttachmentOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic override readonly type = ApplicationCommandOptionType.Attachment as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandAttachmentOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import type { APIApplicationCommandBasicOption, ApplicationCommandOptionType } from 'discord-api-types/v10';\nimport { validateRequiredParameters, validateRequired, validateLocalizationMap } from '../Assertions.js';\nimport { SharedNameAndDescription } from './NameAndDescription.js';\n\n/**\n * The base application command option builder that contains common symbols for application command builders.\n */\nexport abstract class ApplicationCommandOptionBase extends SharedNameAndDescription {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic abstract readonly type: ApplicationCommandOptionType;\n\n\t/**\n\t * Whether this option is required.\n\t *\n\t * @defaultValue `false`\n\t */\n\tpublic readonly required: boolean = false;\n\n\t/**\n\t * Sets whether this option is required.\n\t *\n\t * @param required - Whether this option should be required\n\t */\n\tpublic setRequired(required: boolean) {\n\t\t// Assert that you actually passed a boolean\n\t\tvalidateRequired(required);\n\n\t\tReflect.set(this, 'required', required);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic abstract toJSON(): APIApplicationCommandBasicOption;\n\n\t/**\n\t * This method runs required validators on this builder.\n\t */\n\tprotected runRequiredValidations() {\n\t\tvalidateRequiredParameters(this.name, this.description, []);\n\n\t\t// Validate localizations\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\t// Assert that you actually passed a boolean\n\t\tvalidateRequired(this.required);\n\t}\n}\n","import { ApplicationCommandOptionType, type APIApplicationCommandBooleanOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command boolean option.\n */\nexport class SlashCommandBooleanOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.Boolean as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandBooleanOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import { ApplicationCommandOptionType, type APIApplicationCommandChannelOption } from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\nimport { ApplicationCommandOptionChannelTypesMixin } from '../mixins/ApplicationCommandOptionChannelTypesMixin.js';\n\n/**\n * A slash command channel option.\n */\n@mix(ApplicationCommandOptionChannelTypesMixin)\nexport class SlashCommandChannelOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic override readonly type = ApplicationCommandOptionType.Channel as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandChannelOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n\nexport interface SlashCommandChannelOption extends ApplicationCommandOptionChannelTypesMixin {}\n","import { s } from '@sapphire/shapeshift';\nimport { ChannelType } from 'discord-api-types/v10';\n\n/**\n * The allowed channel types used for a channel option in a slash command builder.\n *\n * @privateRemarks This can't be dynamic because const enums are erased at runtime.\n * @internal\n */\nconst allowedChannelTypes = [\n\tChannelType.GuildText,\n\tChannelType.GuildVoice,\n\tChannelType.GuildCategory,\n\tChannelType.GuildAnnouncement,\n\tChannelType.AnnouncementThread,\n\tChannelType.PublicThread,\n\tChannelType.PrivateThread,\n\tChannelType.GuildStageVoice,\n\tChannelType.GuildForum,\n\tChannelType.GuildMedia,\n] as const;\n\n/**\n * The type of allowed channel types used for a channel option.\n */\nexport type ApplicationCommandOptionAllowedChannelTypes = (typeof allowedChannelTypes)[number];\n\nconst channelTypesPredicate = s.array(s.union(...allowedChannelTypes.map((type) => s.literal(type))));\n\n/**\n * This mixin holds channel type symbols used for options.\n */\nexport class ApplicationCommandOptionChannelTypesMixin {\n\t/**\n\t * The channel types of this option.\n\t */\n\tpublic readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[];\n\n\t/**\n\t * Adds channel types to this option.\n\t *\n\t * @param channelTypes - The channel types\n\t */\n\tpublic addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]) {\n\t\tif (this.channel_types === undefined) {\n\t\t\tReflect.set(this, 'channel_types', []);\n\t\t}\n\n\t\tthis.channel_types!.push(...channelTypesPredicate.parse(channelTypes));\n\n\t\treturn this;\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandOptionType, type APIApplicationCommandIntegerOption } from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { ApplicationCommandNumericOptionMinMaxValueMixin } from '../mixins/ApplicationCommandNumericOptionMinMaxValueMixin.js';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\nimport { ApplicationCommandOptionWithChoicesAndAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.js';\n\nconst numberValidator = s.number.int;\n\n/**\n * A slash command integer option.\n */\n@mix(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin)\nexport class SlashCommandIntegerOption\n\textends ApplicationCommandOptionBase\n\timplements ApplicationCommandNumericOptionMinMaxValueMixin\n{\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.Integer as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue}\n\t */\n\tpublic setMaxValue(max: number): this {\n\t\tnumberValidator.parse(max);\n\n\t\tReflect.set(this, 'max_value', max);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue}\n\t */\n\tpublic setMinValue(min: number): this {\n\t\tnumberValidator.parse(min);\n\n\t\tReflect.set(this, 'min_value', min);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandIntegerOption {\n\t\tthis.runRequiredValidations();\n\n\t\tif (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\treturn { ...this } as APIApplicationCommandIntegerOption;\n\t}\n}\n\nexport interface SlashCommandIntegerOption\n\textends ApplicationCommandNumericOptionMinMaxValueMixin,\n\t\tApplicationCommandOptionWithChoicesAndAutocompleteMixin {}\n","/**\n * This mixin holds minimum and maximum symbols used for options.\n */\nexport abstract class ApplicationCommandNumericOptionMinMaxValueMixin {\n\t/**\n\t * The maximum value of this option.\n\t */\n\tpublic readonly max_value?: number;\n\n\t/**\n\t * The minimum value of this option.\n\t */\n\tpublic readonly min_value?: number;\n\n\t/**\n\t * Sets the maximum number value of this option.\n\t *\n\t * @param max - The maximum value this option can be\n\t */\n\tpublic abstract setMaxValue(max: number): this;\n\n\t/**\n\t * Sets the minimum number value of this option.\n\t *\n\t * @param min - The minimum value this option can be\n\t */\n\tpublic abstract setMinValue(min: number): this;\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandOptionType, type APIApplicationCommandOptionChoice } from 'discord-api-types/v10';\nimport { localizationMapPredicate, validateChoicesLength } from '../Assertions.js';\n\nconst stringPredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);\nconst numberPredicate = s.number.greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);\nconst choicesPredicate = s.object({\n\tname: stringPredicate,\n\tname_localizations: localizationMapPredicate,\n\tvalue: s.union(stringPredicate, numberPredicate),\n}).array;\nconst booleanPredicate = s.boolean;\n\n/**\n * This mixin holds choices and autocomplete symbols used for options.\n */\nexport class ApplicationCommandOptionWithChoicesAndAutocompleteMixin {\n\t/**\n\t * The choices of this option.\n\t */\n\tpublic readonly choices?: APIApplicationCommandOptionChoice[];\n\n\t/**\n\t * Whether this option utilizes autocomplete.\n\t */\n\tpublic readonly autocomplete?: boolean;\n\n\t/**\n\t * The type of this option.\n\t *\n\t * @privateRemarks Since this is present and this is a mixin, this is needed.\n\t */\n\tpublic readonly type!: ApplicationCommandOptionType;\n\n\t/**\n\t * Adds multiple choices to this option.\n\t *\n\t * @param choices - The choices to add\n\t */\n\tpublic addChoices(...choices: APIApplicationCommandOptionChoice[]): this {\n\t\tif (choices.length > 0 && this.autocomplete) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tchoicesPredicate.parse(choices);\n\n\t\tif (this.choices === undefined) {\n\t\t\tReflect.set(this, 'choices', []);\n\t\t}\n\n\t\tvalidateChoicesLength(choices.length, this.choices);\n\n\t\tfor (const { name, name_localizations, value } of choices) {\n\t\t\t// Validate the value\n\t\t\tif (this.type === ApplicationCommandOptionType.String) {\n\t\t\t\tstringPredicate.parse(value);\n\t\t\t} else {\n\t\t\t\tnumberPredicate.parse(value);\n\t\t\t}\n\n\t\t\tthis.choices!.push({ name, name_localizations, value });\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets multiple choices for this option.\n\t *\n\t * @param choices - The choices to set\n\t */\n\tpublic setChoices[]>(...choices: Input): this {\n\t\tif (choices.length > 0 && this.autocomplete) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tchoicesPredicate.parse(choices);\n\n\t\tReflect.set(this, 'choices', []);\n\t\tthis.addChoices(...choices);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Whether this option uses autocomplete.\n\t *\n\t * @param autocomplete - Whether this option should use autocomplete\n\t */\n\tpublic setAutocomplete(autocomplete: boolean): this {\n\t\t// Assert that you actually passed a boolean\n\t\tbooleanPredicate.parse(autocomplete);\n\n\t\tif (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tReflect.set(this, 'autocomplete', autocomplete);\n\n\t\treturn this;\n\t}\n}\n","import { ApplicationCommandOptionType, type APIApplicationCommandMentionableOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command mentionable option.\n */\nexport class SlashCommandMentionableOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.Mentionable as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandMentionableOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandOptionType, type APIApplicationCommandNumberOption } from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { ApplicationCommandNumericOptionMinMaxValueMixin } from '../mixins/ApplicationCommandNumericOptionMinMaxValueMixin.js';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\nimport { ApplicationCommandOptionWithChoicesAndAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.js';\n\nconst numberValidator = s.number;\n\n/**\n * A slash command number option.\n */\n@mix(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin)\nexport class SlashCommandNumberOption\n\textends ApplicationCommandOptionBase\n\timplements ApplicationCommandNumericOptionMinMaxValueMixin\n{\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.Number as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue}\n\t */\n\tpublic setMaxValue(max: number): this {\n\t\tnumberValidator.parse(max);\n\n\t\tReflect.set(this, 'max_value', max);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue}\n\t */\n\tpublic setMinValue(min: number): this {\n\t\tnumberValidator.parse(min);\n\n\t\tReflect.set(this, 'min_value', min);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandNumberOption {\n\t\tthis.runRequiredValidations();\n\n\t\tif (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\treturn { ...this } as APIApplicationCommandNumberOption;\n\t}\n}\n\nexport interface SlashCommandNumberOption\n\textends ApplicationCommandNumericOptionMinMaxValueMixin,\n\t\tApplicationCommandOptionWithChoicesAndAutocompleteMixin {}\n","import { ApplicationCommandOptionType, type APIApplicationCommandRoleOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command role option.\n */\nexport class SlashCommandRoleOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic override readonly type = ApplicationCommandOptionType.Role as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandRoleOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandOptionType, type APIApplicationCommandStringOption } from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\nimport { ApplicationCommandOptionWithChoicesAndAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.js';\n\nconst minLengthValidator = s.number.greaterThanOrEqual(0).lessThanOrEqual(6_000);\nconst maxLengthValidator = s.number.greaterThanOrEqual(1).lessThanOrEqual(6_000);\n\n/**\n * A slash command string option.\n */\n@mix(ApplicationCommandOptionWithChoicesAndAutocompleteMixin)\nexport class SlashCommandStringOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.String as const;\n\n\t/**\n\t * The maximum length of this option.\n\t */\n\tpublic readonly max_length?: number;\n\n\t/**\n\t * The minimum length of this option.\n\t */\n\tpublic readonly min_length?: number;\n\n\t/**\n\t * Sets the maximum length of this string option.\n\t *\n\t * @param max - The maximum length this option can be\n\t */\n\tpublic setMaxLength(max: number): this {\n\t\tmaxLengthValidator.parse(max);\n\n\t\tReflect.set(this, 'max_length', max);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum length of this string option.\n\t *\n\t * @param min - The minimum length this option can be\n\t */\n\tpublic setMinLength(min: number): this {\n\t\tminLengthValidator.parse(min);\n\n\t\tReflect.set(this, 'min_length', min);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandStringOption {\n\t\tthis.runRequiredValidations();\n\n\t\tif (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\treturn { ...this } as APIApplicationCommandStringOption;\n\t}\n}\n\nexport interface SlashCommandStringOption extends ApplicationCommandOptionWithChoicesAndAutocompleteMixin {}\n","import { ApplicationCommandOptionType, type APIApplicationCommandUserOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command user option.\n */\nexport class SlashCommandUserOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.User as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandUserOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import { assertReturnOfBuilder, validateMaxOptionsLength } from '../Assertions.js';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SlashCommandAttachmentOption } from '../options/attachment.js';\nimport { SlashCommandBooleanOption } from '../options/boolean.js';\nimport { SlashCommandChannelOption } from '../options/channel.js';\nimport { SlashCommandIntegerOption } from '../options/integer.js';\nimport { SlashCommandMentionableOption } from '../options/mentionable.js';\nimport { SlashCommandNumberOption } from '../options/number.js';\nimport { SlashCommandRoleOption } from '../options/role.js';\nimport { SlashCommandStringOption } from '../options/string.js';\nimport { SlashCommandUserOption } from '../options/user.js';\nimport type { ApplicationCommandOptionBase } from './ApplicationCommandOptionBase.js';\n\n/**\n * This mixin holds symbols that can be shared in slash command options.\n *\n * @typeParam ShouldOmitSubcommandFunctions - Whether to omit subcommand functions.\n */\nexport class SharedSlashCommandOptions {\n\tpublic readonly options!: ToAPIApplicationCommandOptions[];\n\n\t/**\n\t * Adds a boolean option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addBooleanOption(\n\t\tinput: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandBooleanOption);\n\t}\n\n\t/**\n\t * Adds a user option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandUserOption);\n\t}\n\n\t/**\n\t * Adds a channel option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addChannelOption(\n\t\tinput: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandChannelOption);\n\t}\n\n\t/**\n\t * Adds a role option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandRoleOption);\n\t}\n\n\t/**\n\t * Adds an attachment option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addAttachmentOption(\n\t\tinput: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandAttachmentOption);\n\t}\n\n\t/**\n\t * Adds a mentionable option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addMentionableOption(\n\t\tinput: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandMentionableOption);\n\t}\n\n\t/**\n\t * Adds a string option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addStringOption(\n\t\tinput:\n\t\t\t| Omit\n\t\t\t| Omit\n\t\t\t| SlashCommandStringOption\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandStringOption,\n\t\t\t ) =>\n\t\t\t\t\t| Omit\n\t\t\t\t\t| Omit\n\t\t\t\t\t| SlashCommandStringOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandStringOption);\n\t}\n\n\t/**\n\t * Adds an integer option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addIntegerOption(\n\t\tinput:\n\t\t\t| Omit\n\t\t\t| Omit\n\t\t\t| SlashCommandIntegerOption\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandIntegerOption,\n\t\t\t ) =>\n\t\t\t\t\t| Omit\n\t\t\t\t\t| Omit\n\t\t\t\t\t| SlashCommandIntegerOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandIntegerOption);\n\t}\n\n\t/**\n\t * Adds a number option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addNumberOption(\n\t\tinput:\n\t\t\t| Omit\n\t\t\t| Omit\n\t\t\t| SlashCommandNumberOption\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandNumberOption,\n\t\t\t ) =>\n\t\t\t\t\t| Omit\n\t\t\t\t\t| Omit\n\t\t\t\t\t| SlashCommandNumberOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandNumberOption);\n\t}\n\n\t/**\n\t * Where the actual adding magic happens. ✨\n\t *\n\t * @param input - The input. What else?\n\t * @param Instance - The instance of whatever is being added\n\t * @internal\n\t */\n\tprivate _sharedAddOptionMethod(\n\t\tinput:\n\t\t\t| Omit\n\t\t\t| Omit\n\t\t\t| OptionBuilder\n\t\t\t| ((\n\t\t\t\t\tbuilder: OptionBuilder,\n\t\t\t ) => Omit | Omit | OptionBuilder),\n\t\tInstance: new () => OptionBuilder,\n\t): ShouldOmitSubcommandFunctions extends true ? Omit : this {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new Instance()) : input;\n\n\t\tassertReturnOfBuilder(result, Instance);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandType } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../../util/validation.js';\nimport type { ContextMenuCommandType } from './ContextMenuCommandBuilder.js';\n\nconst namePredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(32)\n\t// eslint-disable-next-line prefer-named-capture-group\n\t.regex(/^( *[\\p{P}\\p{L}\\p{N}\\p{sc=Devanagari}\\p{sc=Thai}]+ *)+$/u)\n\t.setValidationEnabled(isValidationEnabled);\nconst typePredicate = s\n\t.union(s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message))\n\t.setValidationEnabled(isValidationEnabled);\nconst booleanPredicate = s.boolean;\n\nexport function validateDefaultPermission(value: unknown): asserts value is boolean {\n\tbooleanPredicate.parse(value);\n}\n\nexport function validateName(name: unknown): asserts name is string {\n\tnamePredicate.parse(name);\n}\n\nexport function validateType(type: unknown): asserts type is ContextMenuCommandType {\n\ttypePredicate.parse(type);\n}\n\nexport function validateRequiredParameters(name: string, type: number) {\n\t// Assert name matches all conditions\n\tvalidateName(name);\n\n\t// Assert type is valid\n\tvalidateType(type);\n}\n\nconst dmPermissionPredicate = s.boolean.nullish;\n\nexport function validateDMPermission(value: unknown): asserts value is boolean | null | undefined {\n\tdmPermissionPredicate.parse(value);\n}\n\nconst memberPermissionPredicate = s.union(\n\ts.bigint.transform((value) => value.toString()),\n\ts.number.safeInt.transform((value) => value.toString()),\n\ts.string.regex(/^\\d+$/),\n).nullish;\n\nexport function validateDefaultMemberPermissions(permissions: unknown) {\n\treturn memberPermissionPredicate.parse(permissions);\n}\n","import type {\n\tApplicationCommandType,\n\tLocaleString,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIContextMenuApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { validateLocale, validateLocalizationMap } from '../slashCommands/Assertions.js';\nimport {\n\tvalidateRequiredParameters,\n\tvalidateName,\n\tvalidateType,\n\tvalidateDefaultPermission,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDMPermission,\n} from './Assertions.js';\n\n/**\n * The type a context menu command can be.\n */\nexport type ContextMenuCommandType = ApplicationCommandType.Message | ApplicationCommandType.User;\n\n/**\n * A builder that creates API-compatible JSON data for context menu commands.\n */\nexport class ContextMenuCommandBuilder {\n\t/**\n\t * The name of this command.\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The name localizations of this command.\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The type of this command.\n\t */\n\tpublic readonly type: ContextMenuCommandType = undefined!;\n\n\t/**\n\t * Whether this command is enabled by default when the application is added to a guild.\n\t *\n\t * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead.\n\t */\n\tpublic readonly default_permission: boolean | undefined = undefined;\n\n\t/**\n\t * The set of permissions represented as a bit set for the command.\n\t */\n\tpublic readonly default_member_permissions: Permissions | null | undefined = undefined;\n\n\t/**\n\t * Indicates whether the command is available in direct messages with the application.\n\t *\n\t * @remarks\n\t * By default, commands are visible. This property is only for global commands.\n\t */\n\tpublic readonly dm_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Sets the name of this command.\n\t *\n\t * @param name - The name to use\n\t */\n\tpublic setName(name: string) {\n\t\t// Assert the name matches the conditions\n\t\tvalidateName(name);\n\n\t\tReflect.set(this, 'name', name);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the type of this command.\n\t *\n\t * @param type - The type to use\n\t */\n\tpublic setType(type: ContextMenuCommandType) {\n\t\t// Assert the type is valid\n\t\tvalidateType(type);\n\n\t\tReflect.set(this, 'type', type);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * @remarks\n\t * If set to `false`, you will have to later `PUT` the permissions for this command.\n\t * @param value - Whether to enable this command by default\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead.\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'default_permission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the default permissions a member should have in order to run this command.\n\t *\n\t * @remarks\n\t * You can set this to `'0'` to disable the command by default.\n\t * @param permissions - The permissions bit field to set\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t */\n\tpublic setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined) {\n\t\t// Assert the value and parse it\n\t\tconst permissionValue = validateDefaultMemberPermissions(permissions);\n\n\t\tReflect.set(this, 'default_member_permissions', permissionValue);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets if the command is available in direct messages with the application.\n\t *\n\t * @remarks\n\t * By default, commands are visible. This method is only for global commands.\n\t * @param enabled - Whether the command should be enabled in direct messages\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t */\n\tpublic setDMPermission(enabled: boolean | null | undefined) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDMPermission(enabled);\n\n\t\tReflect.set(this, 'dm_permission', enabled);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a name localization for this command.\n\t *\n\t * @param locale - The locale to set\n\t * @param localizedName - The localized name for the given `locale`\n\t */\n\tpublic setNameLocalization(locale: LocaleString, localizedName: string | null) {\n\t\tif (!this.name_localizations) {\n\t\t\tReflect.set(this, 'name_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedName === null) {\n\t\t\tthis.name_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateName(localizedName);\n\n\t\tthis.name_localizations![parsedLocale] = localizedName;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the name localizations for this command.\n\t *\n\t * @param localizedNames - The object of localized names to set\n\t */\n\tpublic setNameLocalizations(localizedNames: LocalizationMap | null) {\n\t\tif (localizedNames === null) {\n\t\t\tReflect.set(this, 'name_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'name_localizations', {});\n\n\t\tfor (const args of Object.entries(localizedNames))\n\t\t\tthis.setNameLocalization(...(args as [LocaleString, string | null]));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): RESTPostAPIContextMenuApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.type);\n\n\t\tvalidateLocalizationMap(this.name_localizations);\n\n\t\treturn { ...this };\n\t}\n}\n","import type { APIEmbed } from 'discord-api-types/v10';\n\n/**\n * Calculates the length of the embed.\n *\n * @param data - The embed data to check\n */\nexport function embedLength(data: APIEmbed) {\n\treturn (\n\t\t(data.title?.length ?? 0) +\n\t\t(data.description?.length ?? 0) +\n\t\t(data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) +\n\t\t(data.footer?.text.length ?? 0) +\n\t\t(data.author?.name.length ?? 0)\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAAA;AAAA,EAAA;AAAA,sCAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAkB;;;ACAlB,IAAI,WAAW;AAOR,SAAS,mBAAmB;AAClC,SAAQ,WAAW;AACpB;AAFgB;AAST,SAAS,oBAAoB;AACnC,SAAQ,WAAW;AACpB;AAFgB;AAOT,SAAS,sBAAsB;AACrC,SAAO;AACR;AAFgB;;;ADnBT,IAAM,qBAAqB,oBAAE,OAClC,yBAAyB,CAAC,EAC1B,sBAAsB,GAAG,EACzB,qBAAqB,mBAAmB;AAEnC,IAAM,sBAAsB,oBAAE,OACnC,yBAAyB,CAAC,EAC1B,sBAAsB,IAAK,EAC3B,qBAAqB,mBAAmB;AAEnC,IAAM,uBAAuB,oBAAE,QAAQ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AsB,eAA8B;AAC9E,QAAI,CAAC,KAAK,oBAAoB;AAC7B,cAAQ,IAAI,MAAM,sBAAsB,CAAC,CAAC;AAAA,IAC3C;AAEA,UAAM,eAAe,eAAe,MAAM;AAE1C,QAAI,kBAAkB,MAAM;AAC3B,WAAK,mBAAoB,YAAY,IAAI;AACzC,aAAO;AAAA,IACR;AAEA,IAAAH,cAAa,aAAa;AAE1B,SAAK,mBAAoB,YAAY,IAAI;AACzC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,qBAAqB,gBAAwC;AACnE,QAAI,mBAAmB,MAAM;AAC5B,cAAQ,IAAI,MAAM,sBAAsB,IAAI;AAC5C,aAAO;AAAA,IACR;AAEA,YAAQ,IAAI,MAAM,sBAAsB,CAAC,CAAC;AAE1C,eAAW,QAAQ,OAAO,QAAQ,cAAc;AAC/C,WAAK,oBAAoB,GAAI,IAAsC;AACpE,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,SAA4D;AAClE,IAAAI,4BAA2B,KAAK,MAAM,KAAK,IAAI;AAE/C,4BAAwB,KAAK,kBAAkB;AAE/C,WAAO,EAAE,GAAG,KAAK;AAAA,EAClB;AACD;;;AC9LO,SAAS,YAAY,MAAgB;AAC3C,UACE,KAAK,OAAO,UAAU,MACtB,KAAK,aAAa,UAAU,MAC5B,KAAK,QAAQ,OAAO,CAAC,MAAM,SAAS,OAAO,KAAK,KAAK,SAAS,KAAK,MAAM,QAAQ,CAAC,KAAK,MACvF,KAAK,QAAQ,KAAK,UAAU,MAC5B,KAAK,QAAQ,KAAK,UAAU;AAE/B;AARgB;;;AzC6DT,IAAM,UAAU;","names":["Assertions_exports","Assertions_exports","import_shapeshift","import_v10","import_v10","import_v10","import_v10","import_v10","import_v10","import_v10","import_v10","import_v10","Assertions_exports","placeholderValidator","import_shapeshift","import_v10","placeholderValidator","placeholderValidator","isEqual","Assertions_exports","validateRequiredParameters","import_shapeshift","validateRequiredParameters","validateRequiredParameters","Assertions_exports","validateRequiredParameters","import_shapeshift","import_v10","descriptionPredicate","validateRequiredParameters","import_ts_mixer","import_v10","import_ts_mixer","import_v10","validateRequiredParameters","import_v10","import_v10","import_shapeshift","import_v10","import_shapeshift","import_v10","import_ts_mixer","import_shapeshift","import_v10","booleanPredicate","import_v10","import_shapeshift","import_v10","import_ts_mixer","numberValidator","import_v10","import_shapeshift","import_v10","import_ts_mixer","minLengthValidator","maxLengthValidator","import_v10","validateRequiredParameters","validateRequiredParameters","Assertions_exports","validateDMPermission","validateDefaultMemberPermissions","validateDefaultPermission","validateName","validateRequiredParameters","import_shapeshift","import_v10","namePredicate","booleanPredicate","validateDefaultPermission","validateName","validateRequiredParameters","dmPermissionPredicate","validateDMPermission","memberPermissionPredicate","validateDefaultMemberPermissions","validateName","validateDefaultPermission","validateDefaultMemberPermissions","validateDMPermission","validateRequiredParameters"]} \ No newline at end of file diff --git a/node_modules/@discordjs/builders/dist/index.mjs b/node_modules/@discordjs/builders/dist/index.mjs new file mode 100644 index 0000000..6112a1a --- /dev/null +++ b/node_modules/@discordjs/builders/dist/index.mjs @@ -0,0 +1,2703 @@ +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +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 __decorateClass = (decorators, target, key, kind) => { + var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; + for (var i = decorators.length - 1, decorator; i >= 0; i--) + if (decorator = decorators[i]) + result = (kind ? decorator(target, key, result) : decorator(result)) || result; + if (kind && result) + __defProp(target, key, result); + return result; +}; + +// src/messages/embed/Assertions.ts +var Assertions_exports = {}; +__export(Assertions_exports, { + RGBPredicate: () => RGBPredicate, + authorNamePredicate: () => authorNamePredicate, + colorPredicate: () => colorPredicate, + descriptionPredicate: () => descriptionPredicate, + embedAuthorPredicate: () => embedAuthorPredicate, + embedFieldPredicate: () => embedFieldPredicate, + embedFieldsArrayPredicate: () => embedFieldsArrayPredicate, + embedFooterPredicate: () => embedFooterPredicate, + fieldInlinePredicate: () => fieldInlinePredicate, + fieldLengthPredicate: () => fieldLengthPredicate, + fieldNamePredicate: () => fieldNamePredicate, + fieldValuePredicate: () => fieldValuePredicate, + footerTextPredicate: () => footerTextPredicate, + imageURLPredicate: () => imageURLPredicate, + timestampPredicate: () => timestampPredicate, + titlePredicate: () => titlePredicate, + urlPredicate: () => urlPredicate, + validateFieldLength: () => validateFieldLength +}); +import { s } from "@sapphire/shapeshift"; + +// src/util/validation.ts +var validate = true; +function enableValidators() { + return validate = true; +} +__name(enableValidators, "enableValidators"); +function disableValidators() { + return validate = false; +} +__name(disableValidators, "disableValidators"); +function isValidationEnabled() { + return validate; +} +__name(isValidationEnabled, "isValidationEnabled"); + +// src/messages/embed/Assertions.ts +var fieldNamePredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(256).setValidationEnabled(isValidationEnabled); +var fieldValuePredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024).setValidationEnabled(isValidationEnabled); +var fieldInlinePredicate = s.boolean.optional; +var embedFieldPredicate = s.object({ + name: fieldNamePredicate, + value: fieldValuePredicate, + inline: fieldInlinePredicate +}).setValidationEnabled(isValidationEnabled); +var embedFieldsArrayPredicate = embedFieldPredicate.array.setValidationEnabled(isValidationEnabled); +var fieldLengthPredicate = s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +function validateFieldLength(amountAdding, fields) { + fieldLengthPredicate.parse((fields?.length ?? 0) + amountAdding); +} +__name(validateFieldLength, "validateFieldLength"); +var authorNamePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled); +var imageURLPredicate = s.string.url({ + allowedProtocols: ["http:", "https:", "attachment:"] +}).nullish.setValidationEnabled(isValidationEnabled); +var urlPredicate = s.string.url({ + allowedProtocols: ["http:", "https:"] +}).nullish.setValidationEnabled(isValidationEnabled); +var embedAuthorPredicate = s.object({ + name: authorNamePredicate, + iconURL: imageURLPredicate, + url: urlPredicate +}).setValidationEnabled(isValidationEnabled); +var RGBPredicate = s.number.int.greaterThanOrEqual(0).lessThanOrEqual(255).setValidationEnabled(isValidationEnabled); +var colorPredicate = s.number.int.greaterThanOrEqual(0).lessThanOrEqual(16777215).or(s.tuple([RGBPredicate, RGBPredicate, RGBPredicate])).nullable.setValidationEnabled(isValidationEnabled); +var descriptionPredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4096).nullable.setValidationEnabled(isValidationEnabled); +var footerTextPredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(2048).nullable.setValidationEnabled(isValidationEnabled); +var embedFooterPredicate = s.object({ + text: footerTextPredicate, + iconURL: imageURLPredicate +}).setValidationEnabled(isValidationEnabled); +var timestampPredicate = s.union(s.number, s.date).nullable.setValidationEnabled(isValidationEnabled); +var titlePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled); + +// src/util/normalizeArray.ts +function normalizeArray(arr) { + if (Array.isArray(arr[0])) + return arr[0]; + return arr; +} +__name(normalizeArray, "normalizeArray"); + +// src/messages/embed/Embed.ts +var EmbedBuilder = class { + static { + __name(this, "EmbedBuilder"); + } + /** + * The API data associated with this embed. + */ + data; + /** + * Creates a new embed from API data. + * + * @param data - The API data to create this embed with + */ + constructor(data = {}) { + this.data = { ...data }; + if (data.timestamp) + this.data.timestamp = new Date(data.timestamp).toISOString(); + } + /** + * Appends fields to the embed. + * + * @remarks + * This method accepts either an array of fields or a variable number of field parameters. + * The maximum amount of fields that can be added is 25. + * @example + * Using an array: + * ```ts + * const fields: APIEmbedField[] = ...; + * const embed = new EmbedBuilder() + * .addFields(fields); + * ``` + * @example + * Using rest parameters (variadic): + * ```ts + * const embed = new EmbedBuilder() + * .addFields( + * { name: 'Field 1', value: 'Value 1' }, + * { name: 'Field 2', value: 'Value 2' }, + * ); + * ``` + * @param fields - The fields to add + */ + addFields(...fields) { + const normalizedFields = normalizeArray(fields); + validateFieldLength(normalizedFields.length, this.data.fields); + embedFieldsArrayPredicate.parse(normalizedFields); + if (this.data.fields) + this.data.fields.push(...normalizedFields); + else + this.data.fields = normalizedFields; + return this; + } + /** + * Removes, replaces, or inserts fields for this embed. + * + * @remarks + * This method behaves similarly + * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}. + * The maximum amount of fields that can be added is 25. + * + * It's useful for modifying and adjusting order of the already-existing fields of an embed. + * @example + * Remove the first field: + * ```ts + * embed.spliceFields(0, 1); + * ``` + * @example + * Remove the first n fields: + * ```ts + * const n = 4; + * embed.spliceFields(0, n); + * ``` + * @example + * Remove the last field: + * ```ts + * embed.spliceFields(-1, 1); + * ``` + * @param index - The index to start at + * @param deleteCount - The number of fields to remove + * @param fields - The replacing field objects + */ + spliceFields(index, deleteCount, ...fields) { + validateFieldLength(fields.length - deleteCount, this.data.fields); + embedFieldsArrayPredicate.parse(fields); + if (this.data.fields) + this.data.fields.splice(index, deleteCount, ...fields); + else + this.data.fields = fields; + return this; + } + /** + * Sets the fields for this embed. + * + * @remarks + * This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically, + * it splices the entire array of fields, replacing them with the provided fields. + * + * You can set a maximum of 25 fields. + * @param fields - The fields to set + */ + setFields(...fields) { + this.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields)); + return this; + } + /** + * Sets the author of this embed. + * + * @param options - The options to use + */ + setAuthor(options) { + if (options === null) { + this.data.author = void 0; + return this; + } + embedAuthorPredicate.parse(options); + this.data.author = { name: options.name, url: options.url, icon_url: options.iconURL }; + return this; + } + /** + * Sets the color of this embed. + * + * @param color - The color to use + */ + setColor(color) { + colorPredicate.parse(color); + if (Array.isArray(color)) { + const [red, green, blue] = color; + this.data.color = (red << 16) + (green << 8) + blue; + return this; + } + this.data.color = color ?? void 0; + return this; + } + /** + * Sets the description of this embed. + * + * @param description - The description to use + */ + setDescription(description) { + descriptionPredicate.parse(description); + this.data.description = description ?? void 0; + return this; + } + /** + * Sets the footer of this embed. + * + * @param options - The footer to use + */ + setFooter(options) { + if (options === null) { + this.data.footer = void 0; + return this; + } + embedFooterPredicate.parse(options); + this.data.footer = { text: options.text, icon_url: options.iconURL }; + return this; + } + /** + * Sets the image of this embed. + * + * @param url - The image URL to use + */ + setImage(url) { + imageURLPredicate.parse(url); + this.data.image = url ? { url } : void 0; + return this; + } + /** + * Sets the thumbnail of this embed. + * + * @param url - The thumbnail URL to use + */ + setThumbnail(url) { + imageURLPredicate.parse(url); + this.data.thumbnail = url ? { url } : void 0; + return this; + } + /** + * Sets the timestamp of this embed. + * + * @param timestamp - The timestamp or date to use + */ + setTimestamp(timestamp = Date.now()) { + timestampPredicate.parse(timestamp); + this.data.timestamp = timestamp ? new Date(timestamp).toISOString() : void 0; + return this; + } + /** + * Sets the title for this embed. + * + * @param title - The title to use + */ + setTitle(title) { + titlePredicate.parse(title); + this.data.title = title ?? void 0; + return this; + } + /** + * Sets the URL of this embed. + * + * @param url - The URL to use + */ + setURL(url) { + urlPredicate.parse(url); + this.data.url = url ?? void 0; + return this; + } + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + return { ...this.data }; + } +}; + +// src/index.ts +export * from "@discordjs/formatters"; + +// src/components/Assertions.ts +var Assertions_exports2 = {}; +__export(Assertions_exports2, { + buttonLabelValidator: () => buttonLabelValidator, + buttonStyleValidator: () => buttonStyleValidator, + channelTypesValidator: () => channelTypesValidator, + customIdValidator: () => customIdValidator, + defaultValidator: () => defaultValidator, + disabledValidator: () => disabledValidator, + emojiValidator: () => emojiValidator, + jsonOptionValidator: () => jsonOptionValidator, + labelValueDescriptionValidator: () => labelValueDescriptionValidator, + minMaxValidator: () => minMaxValidator, + optionValidator: () => optionValidator, + optionsLengthValidator: () => optionsLengthValidator, + optionsValidator: () => optionsValidator, + placeholderValidator: () => placeholderValidator, + urlValidator: () => urlValidator, + validateRequiredButtonParameters: () => validateRequiredButtonParameters, + validateRequiredSelectMenuOptionParameters: () => validateRequiredSelectMenuOptionParameters, + validateRequiredSelectMenuParameters: () => validateRequiredSelectMenuParameters +}); +import { s as s2 } from "@sapphire/shapeshift"; +import { ButtonStyle, ChannelType } from "discord-api-types/v10"; + +// src/components/selectMenu/StringSelectMenuOption.ts +var StringSelectMenuOptionBuilder = class { + /** + * Creates a new string select menu option from API data. + * + * @param data - The API data to create this string select menu option with + * @example + * Creating a string select menu option from an API data object: + * ```ts + * const selectMenuOption = new SelectMenuOptionBuilder({ + * label: 'catchy label', + * value: '1', + * }); + * ``` + * @example + * Creating a string select menu option using setters and API data: + * ```ts + * const selectMenuOption = new SelectMenuOptionBuilder({ + * default: true, + * value: '1', + * }) + * .setLabel('woah'); + * ``` + */ + constructor(data = {}) { + this.data = data; + } + static { + __name(this, "StringSelectMenuOptionBuilder"); + } + /** + * Sets the label for this option. + * + * @param label - The label to use + */ + setLabel(label) { + this.data.label = labelValueDescriptionValidator.parse(label); + return this; + } + /** + * Sets the value for this option. + * + * @param value - The value to use + */ + setValue(value) { + this.data.value = labelValueDescriptionValidator.parse(value); + return this; + } + /** + * Sets the description for this option. + * + * @param description - The description to use + */ + setDescription(description) { + this.data.description = labelValueDescriptionValidator.parse(description); + return this; + } + /** + * Sets whether this option is selected by default. + * + * @param isDefault - Whether this option is selected by default + */ + setDefault(isDefault = true) { + this.data.default = defaultValidator.parse(isDefault); + return this; + } + /** + * Sets the emoji to display for this option. + * + * @param emoji - The emoji to use + */ + setEmoji(emoji) { + this.data.emoji = emojiValidator.parse(emoji); + return this; + } + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON() { + validateRequiredSelectMenuOptionParameters(this.data.label, this.data.value); + return { + ...this.data + }; + } +}; + +// src/components/Assertions.ts +var customIdValidator = s2.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled); +var emojiValidator = s2.object({ + id: s2.string, + name: s2.string, + animated: s2.boolean +}).partial.strict.setValidationEnabled(isValidationEnabled); +var disabledValidator = s2.boolean; +var buttonLabelValidator = s2.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(80).setValidationEnabled(isValidationEnabled); +var buttonStyleValidator = s2.nativeEnum(ButtonStyle); +var placeholderValidator = s2.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled); +var minMaxValidator = s2.number.int.greaterThanOrEqual(0).lessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +var labelValueDescriptionValidator = s2.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled); +var jsonOptionValidator = s2.object({ + label: labelValueDescriptionValidator, + value: labelValueDescriptionValidator, + description: labelValueDescriptionValidator.optional, + emoji: emojiValidator.optional, + default: s2.boolean.optional +}).setValidationEnabled(isValidationEnabled); +var optionValidator = s2.instance(StringSelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled); +var optionsValidator = optionValidator.array.lengthGreaterThanOrEqual(0).setValidationEnabled(isValidationEnabled); +var optionsLengthValidator = s2.number.int.greaterThanOrEqual(0).lessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +function validateRequiredSelectMenuParameters(options, customId) { + customIdValidator.parse(customId); + optionsValidator.parse(options); +} +__name(validateRequiredSelectMenuParameters, "validateRequiredSelectMenuParameters"); +var defaultValidator = s2.boolean; +function validateRequiredSelectMenuOptionParameters(label, value) { + labelValueDescriptionValidator.parse(label); + labelValueDescriptionValidator.parse(value); +} +__name(validateRequiredSelectMenuOptionParameters, "validateRequiredSelectMenuOptionParameters"); +var channelTypesValidator = s2.nativeEnum(ChannelType).array.setValidationEnabled(isValidationEnabled); +var urlValidator = s2.string.url({ + allowedProtocols: ["http:", "https:", "discord:"] +}).setValidationEnabled(isValidationEnabled); +function validateRequiredButtonParameters(style, label, emoji, customId, url) { + if (url && customId) { + throw new RangeError("URL and custom id are mutually exclusive"); + } + if (!label && !emoji) { + throw new RangeError("Buttons must have a label and/or an emoji"); + } + if (style === ButtonStyle.Link) { + if (!url) { + throw new RangeError("Link buttons must have a url"); + } + } else if (url) { + throw new RangeError("Non-link buttons cannot have a url"); + } +} +__name(validateRequiredButtonParameters, "validateRequiredButtonParameters"); + +// src/components/ActionRow.ts +import { + ComponentType as ComponentType9 +} from "discord-api-types/v10"; + +// src/components/Component.ts +var ComponentBuilder = class { + static { + __name(this, "ComponentBuilder"); + } + /** + * The API data associated with this component. + */ + data; + /** + * Constructs a new kind of component. + * + * @param data - The data to construct a component out of + */ + constructor(data) { + this.data = data; + } +}; + +// src/components/Components.ts +import { ComponentType as ComponentType8 } from "discord-api-types/v10"; + +// src/components/button/Button.ts +import { + ComponentType +} from "discord-api-types/v10"; +var ButtonBuilder = class extends ComponentBuilder { + static { + __name(this, "ButtonBuilder"); + } + /** + * Creates a new button from API data. + * + * @param data - The API data to create this button with + * @example + * Creating a button from an API data object: + * ```ts + * const button = new ButtonBuilder({ + * custom_id: 'a cool button', + * style: ButtonStyle.Primary, + * label: 'Click Me', + * emoji: { + * name: 'smile', + * id: '123456789012345678', + * }, + * }); + * ``` + * @example + * Creating a button using setters and API data: + * ```ts + * const button = new ButtonBuilder({ + * style: ButtonStyle.Secondary, + * label: 'Click Me', + * }) + * .setEmoji({ name: '🙂' }) + * .setCustomId('another cool button'); + * ``` + */ + constructor(data) { + super({ type: ComponentType.Button, ...data }); + } + /** + * Sets the style of this button. + * + * @param style - The style to use + */ + setStyle(style) { + this.data.style = buttonStyleValidator.parse(style); + return this; + } + /** + * Sets the URL for this button. + * + * @remarks + * This method is only available to buttons using the `Link` button style. + * Only three types of URL schemes are currently supported: `https://`, `http://`, and `discord://`. + * @param url - The URL to use + */ + setURL(url) { + this.data.url = urlValidator.parse(url); + return this; + } + /** + * Sets the custom id for this button. + * + * @remarks + * This method is only applicable to buttons that are not using the `Link` button style. + * @param customId - The custom id to use + */ + setCustomId(customId) { + this.data.custom_id = customIdValidator.parse(customId); + return this; + } + /** + * Sets the emoji to display on this button. + * + * @param emoji - The emoji to use + */ + setEmoji(emoji) { + this.data.emoji = emojiValidator.parse(emoji); + return this; + } + /** + * Sets whether this button is disabled. + * + * @param disabled - Whether to disable this button + */ + setDisabled(disabled = true) { + this.data.disabled = disabledValidator.parse(disabled); + return this; + } + /** + * Sets the label for this button. + * + * @param label - The label to use + */ + setLabel(label) { + this.data.label = buttonLabelValidator.parse(label); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + validateRequiredButtonParameters( + this.data.style, + this.data.label, + this.data.emoji, + this.data.custom_id, + this.data.url + ); + return { + ...this.data + }; + } +}; + +// src/components/selectMenu/ChannelSelectMenu.ts +import { + ComponentType as ComponentType2, + SelectMenuDefaultValueType +} from "discord-api-types/v10"; + +// src/components/selectMenu/BaseSelectMenu.ts +var BaseSelectMenuBuilder = class extends ComponentBuilder { + static { + __name(this, "BaseSelectMenuBuilder"); + } + /** + * Sets the placeholder for this select menu. + * + * @param placeholder - The placeholder to use + */ + setPlaceholder(placeholder) { + this.data.placeholder = placeholderValidator.parse(placeholder); + return this; + } + /** + * Sets the minimum values that must be selected in the select menu. + * + * @param minValues - The minimum values that must be selected + */ + setMinValues(minValues) { + this.data.min_values = minMaxValidator.parse(minValues); + return this; + } + /** + * Sets the maximum values that must be selected in the select menu. + * + * @param maxValues - The maximum values that must be selected + */ + setMaxValues(maxValues) { + this.data.max_values = minMaxValidator.parse(maxValues); + return this; + } + /** + * Sets the custom id for this select menu. + * + * @param customId - The custom id to use + */ + setCustomId(customId) { + this.data.custom_id = customIdValidator.parse(customId); + return this; + } + /** + * Sets whether this select menu is disabled. + * + * @param disabled - Whether this select menu is disabled + */ + setDisabled(disabled = true) { + this.data.disabled = disabledValidator.parse(disabled); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + customIdValidator.parse(this.data.custom_id); + return { + ...this.data + }; + } +}; + +// src/components/selectMenu/ChannelSelectMenu.ts +var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "ChannelSelectMenuBuilder"); + } + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new ChannelSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new ChannelSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + * .setMinValues(2); + * ``` + */ + constructor(data) { + super({ ...data, type: ComponentType2.ChannelSelect }); + } + /** + * Adds channel types to this select menu. + * + * @param types - The channel types to use + */ + addChannelTypes(...types) { + const normalizedTypes = normalizeArray(types); + this.data.channel_types ??= []; + this.data.channel_types.push(...channelTypesValidator.parse(normalizedTypes)); + return this; + } + /** + * Sets channel types for this select menu. + * + * @param types - The channel types to use + */ + setChannelTypes(...types) { + const normalizedTypes = normalizeArray(types); + this.data.channel_types ??= []; + this.data.channel_types.splice(0, this.data.channel_types.length, ...channelTypesValidator.parse(normalizedTypes)); + return this; + } + /** + * Adds default channels to this auto populated select menu. + * + * @param channels - The channels to add + */ + addDefaultChannels(...channels) { + const normalizedValues = normalizeArray(channels); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: SelectMenuDefaultValueType.Channel + })) + ); + return this; + } + /** + * Sets default channels to this auto populated select menu. + * + * @param channels - The channels to set + */ + setDefaultChannels(...channels) { + const normalizedValues = normalizeArray(channels); + optionsLengthValidator.parse(normalizedValues.length); + this.data.default_values = normalizedValues.map((id) => ({ + id, + type: SelectMenuDefaultValueType.Channel + })); + return this; + } + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON() { + customIdValidator.parse(this.data.custom_id); + return { + ...this.data + }; + } +}; + +// src/components/selectMenu/MentionableSelectMenu.ts +import { + ComponentType as ComponentType3, + SelectMenuDefaultValueType as SelectMenuDefaultValueType2 +} from "discord-api-types/v10"; +var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "MentionableSelectMenuBuilder"); + } + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new MentionableSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new MentionableSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data) { + super({ ...data, type: ComponentType3.MentionableSelect }); + } + /** + * Adds default roles to this auto populated select menu. + * + * @param roles - The roles to add + */ + addDefaultRoles(...roles) { + const normalizedValues = normalizeArray(roles); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: SelectMenuDefaultValueType2.Role + })) + ); + return this; + } + /** + * Adds default users to this auto populated select menu. + * + * @param users - The users to add + */ + addDefaultUsers(...users) { + const normalizedValues = normalizeArray(users); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: SelectMenuDefaultValueType2.User + })) + ); + return this; + } + /** + * Adds default values to this auto populated select menu. + * + * @param values - The values to add + */ + addDefaultValues(...values) { + const normalizedValues = normalizeArray(values); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push(...normalizedValues); + return this; + } + /** + * Sets default values to this auto populated select menu. + * + * @param values - The values to set + */ + setDefaultValues(...values) { + const normalizedValues = normalizeArray(values); + optionsLengthValidator.parse(normalizedValues.length); + this.data.default_values = normalizedValues.slice(); + return this; + } +}; + +// src/components/selectMenu/RoleSelectMenu.ts +import { + ComponentType as ComponentType4, + SelectMenuDefaultValueType as SelectMenuDefaultValueType3 +} from "discord-api-types/v10"; +var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "RoleSelectMenuBuilder"); + } + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new RoleSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new RoleSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data) { + super({ ...data, type: ComponentType4.RoleSelect }); + } + /** + * Adds default roles to this auto populated select menu. + * + * @param roles - The roles to add + */ + addDefaultRoles(...roles) { + const normalizedValues = normalizeArray(roles); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: SelectMenuDefaultValueType3.Role + })) + ); + return this; + } + /** + * Sets default roles to this auto populated select menu. + * + * @param roles - The roles to set + */ + setDefaultRoles(...roles) { + const normalizedValues = normalizeArray(roles); + optionsLengthValidator.parse(normalizedValues.length); + this.data.default_values = normalizedValues.map((id) => ({ + id, + type: SelectMenuDefaultValueType3.Role + })); + return this; + } +}; + +// src/components/selectMenu/StringSelectMenu.ts +import { ComponentType as ComponentType5 } from "discord-api-types/v10"; +var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "StringSelectMenuBuilder"); + } + /** + * The options within this select menu. + */ + options; + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new StringSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * options: [ + * { label: 'option 1', value: '1' }, + * { label: 'option 2', value: '2' }, + * { label: 'option 3', value: '3' }, + * ], + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new StringSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1) + * .addOptions({ + * label: 'Catchy', + * value: 'catch', + * }); + * ``` + */ + constructor(data) { + const { options, ...initData } = data ?? {}; + super({ ...initData, type: ComponentType5.StringSelect }); + this.options = options?.map((option) => new StringSelectMenuOptionBuilder(option)) ?? []; + } + /** + * Adds options to this select menu. + * + * @param options - The options to add + */ + addOptions(...options) { + const normalizedOptions = normalizeArray(options); + optionsLengthValidator.parse(this.options.length + normalizedOptions.length); + this.options.push( + ...normalizedOptions.map( + (normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)) + ) + ); + return this; + } + /** + * Sets the options for this select menu. + * + * @param options - The options to set + */ + setOptions(...options) { + return this.spliceOptions(0, this.options.length, ...options); + } + /** + * Removes, replaces, or inserts options for this select menu. + * + * @remarks + * This method behaves similarly + * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice()}. + * It's useful for modifying and adjusting the order of existing options. + * @example + * Remove the first option: + * ```ts + * selectMenu.spliceOptions(0, 1); + * ``` + * @example + * Remove the first n option: + * ```ts + * const n = 4; + * selectMenu.spliceOptions(0, n); + * ``` + * @example + * Remove the last option: + * ```ts + * selectMenu.spliceOptions(-1, 1); + * ``` + * @param index - The index to start at + * @param deleteCount - The number of options to remove + * @param options - The replacing option objects or builders + */ + spliceOptions(index, deleteCount, ...options) { + const normalizedOptions = normalizeArray(options); + const clone = [...this.options]; + clone.splice( + index, + deleteCount, + ...normalizedOptions.map( + (normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)) + ) + ); + optionsLengthValidator.parse(clone.length); + this.options.splice(0, this.options.length, ...clone); + return this; + } + /** + * {@inheritDoc BaseSelectMenuBuilder.toJSON} + */ + toJSON() { + validateRequiredSelectMenuParameters(this.options, this.data.custom_id); + return { + ...this.data, + options: this.options.map((option) => option.toJSON()) + }; + } +}; + +// src/components/selectMenu/UserSelectMenu.ts +import { + ComponentType as ComponentType6, + SelectMenuDefaultValueType as SelectMenuDefaultValueType4 +} from "discord-api-types/v10"; +var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder { + static { + __name(this, "UserSelectMenuBuilder"); + } + /** + * Creates a new select menu from API data. + * + * @param data - The API data to create this select menu with + * @example + * Creating a select menu from an API data object: + * ```ts + * const selectMenu = new UserSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * placeholder: 'select an option', + * max_values: 2, + * }); + * ``` + * @example + * Creating a select menu using setters and API data: + * ```ts + * const selectMenu = new UserSelectMenuBuilder({ + * custom_id: 'a cool select menu', + * }) + * .setMinValues(1); + * ``` + */ + constructor(data) { + super({ ...data, type: ComponentType6.UserSelect }); + } + /** + * Adds default users to this auto populated select menu. + * + * @param users - The users to add + */ + addDefaultUsers(...users) { + const normalizedValues = normalizeArray(users); + optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length); + this.data.default_values ??= []; + this.data.default_values.push( + ...normalizedValues.map((id) => ({ + id, + type: SelectMenuDefaultValueType4.User + })) + ); + return this; + } + /** + * Sets default users to this auto populated select menu. + * + * @param users - The users to set + */ + setDefaultUsers(...users) { + const normalizedValues = normalizeArray(users); + optionsLengthValidator.parse(normalizedValues.length); + this.data.default_values = normalizedValues.map((id) => ({ + id, + type: SelectMenuDefaultValueType4.User + })); + return this; + } +}; + +// src/components/textInput/TextInput.ts +import { isJSONEncodable } from "@discordjs/util"; +import { ComponentType as ComponentType7 } from "discord-api-types/v10"; +import isEqual from "fast-deep-equal"; + +// src/components/textInput/Assertions.ts +var Assertions_exports3 = {}; +__export(Assertions_exports3, { + labelValidator: () => labelValidator, + maxLengthValidator: () => maxLengthValidator, + minLengthValidator: () => minLengthValidator, + placeholderValidator: () => placeholderValidator2, + requiredValidator: () => requiredValidator, + textInputStyleValidator: () => textInputStyleValidator, + validateRequiredParameters: () => validateRequiredParameters, + valueValidator: () => valueValidator +}); +import { s as s3 } from "@sapphire/shapeshift"; +import { TextInputStyle } from "discord-api-types/v10"; +var textInputStyleValidator = s3.nativeEnum(TextInputStyle); +var minLengthValidator = s3.number.int.greaterThanOrEqual(0).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled); +var maxLengthValidator = s3.number.int.greaterThanOrEqual(1).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled); +var requiredValidator = s3.boolean; +var valueValidator = s3.string.lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled); +var placeholderValidator2 = s3.string.lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled); +var labelValidator = s3.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled); +function validateRequiredParameters(customId, style, label) { + customIdValidator.parse(customId); + textInputStyleValidator.parse(style); + labelValidator.parse(label); +} +__name(validateRequiredParameters, "validateRequiredParameters"); + +// src/components/textInput/TextInput.ts +var TextInputBuilder = class extends ComponentBuilder { + static { + __name(this, "TextInputBuilder"); + } + /** + * Creates a new text input from API data. + * + * @param data - The API data to create this text input with + * @example + * Creating a select menu option from an API data object: + * ```ts + * const textInput = new TextInputBuilder({ + * custom_id: 'a cool select menu', + * label: 'Type something', + * style: TextInputStyle.Short, + * }); + * ``` + * @example + * Creating a select menu option using setters and API data: + * ```ts + * const textInput = new TextInputBuilder({ + * label: 'Type something else', + * }) + * .setCustomId('woah') + * .setStyle(TextInputStyle.Paragraph); + * ``` + */ + constructor(data) { + super({ type: ComponentType7.TextInput, ...data }); + } + /** + * Sets the custom id for this text input. + * + * @param customId - The custom id to use + */ + setCustomId(customId) { + this.data.custom_id = customIdValidator.parse(customId); + return this; + } + /** + * Sets the label for this text input. + * + * @param label - The label to use + */ + setLabel(label) { + this.data.label = labelValidator.parse(label); + return this; + } + /** + * Sets the style for this text input. + * + * @param style - The style to use + */ + setStyle(style) { + this.data.style = textInputStyleValidator.parse(style); + return this; + } + /** + * Sets the minimum length of text for this text input. + * + * @param minLength - The minimum length of text for this text input + */ + setMinLength(minLength) { + this.data.min_length = minLengthValidator.parse(minLength); + return this; + } + /** + * Sets the maximum length of text for this text input. + * + * @param maxLength - The maximum length of text for this text input + */ + setMaxLength(maxLength) { + this.data.max_length = maxLengthValidator.parse(maxLength); + return this; + } + /** + * Sets the placeholder for this text input. + * + * @param placeholder - The placeholder to use + */ + setPlaceholder(placeholder) { + this.data.placeholder = placeholderValidator2.parse(placeholder); + return this; + } + /** + * Sets the value for this text input. + * + * @param value - The value to use + */ + setValue(value) { + this.data.value = valueValidator.parse(value); + return this; + } + /** + * Sets whether this text input is required. + * + * @param required - Whether this text input is required + */ + setRequired(required = true) { + this.data.required = requiredValidator.parse(required); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + validateRequiredParameters(this.data.custom_id, this.data.style, this.data.label); + return { + ...this.data + }; + } + /** + * {@inheritDoc Equatable.equals} + */ + equals(other) { + if (isJSONEncodable(other)) { + return isEqual(other.toJSON(), this.data); + } + return isEqual(other, this.data); + } +}; + +// src/components/Components.ts +function createComponentBuilder(data) { + if (data instanceof ComponentBuilder) { + return data; + } + switch (data.type) { + case ComponentType8.ActionRow: + return new ActionRowBuilder(data); + case ComponentType8.Button: + return new ButtonBuilder(data); + case ComponentType8.StringSelect: + return new StringSelectMenuBuilder(data); + case ComponentType8.TextInput: + return new TextInputBuilder(data); + case ComponentType8.UserSelect: + return new UserSelectMenuBuilder(data); + case ComponentType8.RoleSelect: + return new RoleSelectMenuBuilder(data); + case ComponentType8.MentionableSelect: + return new MentionableSelectMenuBuilder(data); + case ComponentType8.ChannelSelect: + return new ChannelSelectMenuBuilder(data); + default: + throw new Error(`Cannot properly serialize component type: ${data.type}`); + } +} +__name(createComponentBuilder, "createComponentBuilder"); + +// src/components/ActionRow.ts +var ActionRowBuilder = class extends ComponentBuilder { + static { + __name(this, "ActionRowBuilder"); + } + /** + * The components within this action row. + */ + components; + /** + * Creates a new action row from API data. + * + * @param data - The API data to create this action row with + * @example + * Creating an action row from an API data object: + * ```ts + * const actionRow = new ActionRowBuilder({ + * components: [ + * { + * custom_id: "custom id", + * label: "Type something", + * style: TextInputStyle.Short, + * type: ComponentType.TextInput, + * }, + * ], + * }); + * ``` + * @example + * Creating an action row using setters and API data: + * ```ts + * const actionRow = new ActionRowBuilder({ + * components: [ + * { + * custom_id: "custom id", + * label: "Click me", + * style: ButtonStyle.Primary, + * type: ComponentType.Button, + * }, + * ], + * }) + * .addComponents(button2, button3); + * ``` + */ + constructor({ components, ...data } = {}) { + super({ type: ComponentType9.ActionRow, ...data }); + this.components = components?.map((component) => createComponentBuilder(component)) ?? []; + } + /** + * Adds components to this action row. + * + * @param components - The components to add + */ + addComponents(...components) { + this.components.push(...normalizeArray(components)); + return this; + } + /** + * Sets components for this action row. + * + * @param components - The components to set + */ + setComponents(...components) { + this.components.splice(0, this.components.length, ...normalizeArray(components)); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + return { + ...this.data, + components: this.components.map((component) => component.toJSON()) + }; + } +}; + +// src/interactions/modals/Assertions.ts +var Assertions_exports4 = {}; +__export(Assertions_exports4, { + componentsValidator: () => componentsValidator, + titleValidator: () => titleValidator, + validateRequiredParameters: () => validateRequiredParameters2 +}); +import { s as s4 } from "@sapphire/shapeshift"; +var titleValidator = s4.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled); +var componentsValidator = s4.instance(ActionRowBuilder).array.lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled); +function validateRequiredParameters2(customId, title, components) { + customIdValidator.parse(customId); + titleValidator.parse(title); + componentsValidator.parse(components); +} +__name(validateRequiredParameters2, "validateRequiredParameters"); + +// src/interactions/modals/Modal.ts +var ModalBuilder = class { + static { + __name(this, "ModalBuilder"); + } + /** + * The API data associated with this modal. + */ + data; + /** + * The components within this modal. + */ + components = []; + /** + * Creates a new modal from API data. + * + * @param data - The API data to create this modal with + */ + constructor({ components, ...data } = {}) { + this.data = { ...data }; + this.components = components?.map((component) => createComponentBuilder(component)) ?? []; + } + /** + * Sets the title of this modal. + * + * @param title - The title to use + */ + setTitle(title) { + this.data.title = titleValidator.parse(title); + return this; + } + /** + * Sets the custom id of this modal. + * + * @param customId - The custom id to use + */ + setCustomId(customId) { + this.data.custom_id = customIdValidator.parse(customId); + return this; + } + /** + * Adds components to this modal. + * + * @param components - The components to add + */ + addComponents(...components) { + this.components.push( + ...normalizeArray(components).map( + (component) => component instanceof ActionRowBuilder ? component : new ActionRowBuilder(component) + ) + ); + return this; + } + /** + * Sets components for this modal. + * + * @param components - The components to set + */ + setComponents(...components) { + this.components.splice(0, this.components.length, ...normalizeArray(components)); + return this; + } + /** + * {@inheritDoc ComponentBuilder.toJSON} + */ + toJSON() { + validateRequiredParameters2(this.data.custom_id, this.data.title, this.components); + return { + ...this.data, + components: this.components.map((component) => component.toJSON()) + }; + } +}; + +// src/interactions/slashCommands/Assertions.ts +var Assertions_exports5 = {}; +__export(Assertions_exports5, { + assertReturnOfBuilder: () => assertReturnOfBuilder, + localizationMapPredicate: () => localizationMapPredicate, + validateChoicesLength: () => validateChoicesLength, + validateDMPermission: () => validateDMPermission, + validateDefaultMemberPermissions: () => validateDefaultMemberPermissions, + validateDefaultPermission: () => validateDefaultPermission, + validateDescription: () => validateDescription, + validateLocale: () => validateLocale, + validateLocalizationMap: () => validateLocalizationMap, + validateMaxOptionsLength: () => validateMaxOptionsLength, + validateNSFW: () => validateNSFW, + validateName: () => validateName, + validateRequired: () => validateRequired, + validateRequiredParameters: () => validateRequiredParameters3 +}); +import { s as s5 } from "@sapphire/shapeshift"; +import { Locale } from "discord-api-types/v10"; +var namePredicate = s5.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u).setValidationEnabled(isValidationEnabled); +function validateName(name) { + namePredicate.parse(name); +} +__name(validateName, "validateName"); +var descriptionPredicate2 = s5.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled); +var localePredicate = s5.nativeEnum(Locale); +function validateDescription(description) { + descriptionPredicate2.parse(description); +} +__name(validateDescription, "validateDescription"); +var maxArrayLengthPredicate = s5.unknown.array.lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +function validateLocale(locale) { + return localePredicate.parse(locale); +} +__name(validateLocale, "validateLocale"); +function validateMaxOptionsLength(options) { + maxArrayLengthPredicate.parse(options); +} +__name(validateMaxOptionsLength, "validateMaxOptionsLength"); +function validateRequiredParameters3(name, description, options) { + validateName(name); + validateDescription(description); + validateMaxOptionsLength(options); +} +__name(validateRequiredParameters3, "validateRequiredParameters"); +var booleanPredicate = s5.boolean; +function validateDefaultPermission(value) { + booleanPredicate.parse(value); +} +__name(validateDefaultPermission, "validateDefaultPermission"); +function validateRequired(required) { + booleanPredicate.parse(required); +} +__name(validateRequired, "validateRequired"); +var choicesLengthPredicate = s5.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled); +function validateChoicesLength(amountAdding, choices) { + choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding); +} +__name(validateChoicesLength, "validateChoicesLength"); +function assertReturnOfBuilder(input, ExpectedInstanceOf) { + s5.instance(ExpectedInstanceOf).parse(input); +} +__name(assertReturnOfBuilder, "assertReturnOfBuilder"); +var localizationMapPredicate = s5.object(Object.fromEntries(Object.values(Locale).map((locale) => [locale, s5.string.nullish]))).strict.nullish.setValidationEnabled(isValidationEnabled); +function validateLocalizationMap(value) { + localizationMapPredicate.parse(value); +} +__name(validateLocalizationMap, "validateLocalizationMap"); +var dmPermissionPredicate = s5.boolean.nullish; +function validateDMPermission(value) { + dmPermissionPredicate.parse(value); +} +__name(validateDMPermission, "validateDMPermission"); +var memberPermissionPredicate = s5.union( + s5.bigint.transform((value) => value.toString()), + s5.number.safeInt.transform((value) => value.toString()), + s5.string.regex(/^\d+$/) +).nullish; +function validateDefaultMemberPermissions(permissions) { + return memberPermissionPredicate.parse(permissions); +} +__name(validateDefaultMemberPermissions, "validateDefaultMemberPermissions"); +function validateNSFW(value) { + booleanPredicate.parse(value); +} +__name(validateNSFW, "validateNSFW"); + +// src/interactions/slashCommands/SlashCommandBuilder.ts +import { mix as mix6 } from "ts-mixer"; + +// src/interactions/slashCommands/SlashCommandSubcommands.ts +import { + ApplicationCommandOptionType as ApplicationCommandOptionType11 +} from "discord-api-types/v10"; +import { mix as mix5 } from "ts-mixer"; + +// src/interactions/slashCommands/mixins/NameAndDescription.ts +var SharedNameAndDescription = class { + static { + __name(this, "SharedNameAndDescription"); + } + /** + * The name of this command. + */ + name; + /** + * The name localizations of this command. + */ + name_localizations; + /** + * The description of this command. + */ + description; + /** + * The description localizations of this command. + */ + description_localizations; + /** + * Sets the name of this command. + * + * @param name - The name to use + */ + setName(name) { + validateName(name); + Reflect.set(this, "name", name); + return this; + } + /** + * Sets the description of this command. + * + * @param description - The description to use + */ + setDescription(description) { + validateDescription(description); + Reflect.set(this, "description", description); + return this; + } + /** + * Sets a name localization for this command. + * + * @param locale - The locale to set + * @param localizedName - The localized name for the given `locale` + */ + setNameLocalization(locale, localizedName) { + if (!this.name_localizations) { + Reflect.set(this, "name_localizations", {}); + } + const parsedLocale = validateLocale(locale); + if (localizedName === null) { + this.name_localizations[parsedLocale] = null; + return this; + } + validateName(localizedName); + this.name_localizations[parsedLocale] = localizedName; + return this; + } + /** + * Sets the name localizations for this command. + * + * @param localizedNames - The object of localized names to set + */ + setNameLocalizations(localizedNames) { + if (localizedNames === null) { + Reflect.set(this, "name_localizations", null); + return this; + } + Reflect.set(this, "name_localizations", {}); + for (const args of Object.entries(localizedNames)) { + this.setNameLocalization(...args); + } + return this; + } + /** + * Sets a description localization for this command. + * + * @param locale - The locale to set + * @param localizedDescription - The localized description for the given locale + */ + setDescriptionLocalization(locale, localizedDescription) { + if (!this.description_localizations) { + Reflect.set(this, "description_localizations", {}); + } + const parsedLocale = validateLocale(locale); + if (localizedDescription === null) { + this.description_localizations[parsedLocale] = null; + return this; + } + validateDescription(localizedDescription); + this.description_localizations[parsedLocale] = localizedDescription; + return this; + } + /** + * Sets the description localizations for this command. + * + * @param localizedDescriptions - The object of localized descriptions to set + */ + setDescriptionLocalizations(localizedDescriptions) { + if (localizedDescriptions === null) { + Reflect.set(this, "description_localizations", null); + return this; + } + Reflect.set(this, "description_localizations", {}); + for (const args of Object.entries(localizedDescriptions)) { + this.setDescriptionLocalization(...args); + } + return this; + } +}; + +// src/interactions/slashCommands/options/attachment.ts +import { ApplicationCommandOptionType } from "discord-api-types/v10"; + +// src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts +var ApplicationCommandOptionBase = class extends SharedNameAndDescription { + static { + __name(this, "ApplicationCommandOptionBase"); + } + /** + * Whether this option is required. + * + * @defaultValue `false` + */ + required = false; + /** + * Sets whether this option is required. + * + * @param required - Whether this option should be required + */ + setRequired(required) { + validateRequired(required); + Reflect.set(this, "required", required); + return this; + } + /** + * This method runs required validators on this builder. + */ + runRequiredValidations() { + validateRequiredParameters3(this.name, this.description, []); + validateLocalizationMap(this.name_localizations); + validateLocalizationMap(this.description_localizations); + validateRequired(this.required); + } +}; + +// src/interactions/slashCommands/options/attachment.ts +var SlashCommandAttachmentOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandAttachmentOption"); + } + /** + * The type of this option. + */ + type = ApplicationCommandOptionType.Attachment; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/options/boolean.ts +import { ApplicationCommandOptionType as ApplicationCommandOptionType2 } from "discord-api-types/v10"; +var SlashCommandBooleanOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandBooleanOption"); + } + /** + * The type of this option. + */ + type = ApplicationCommandOptionType2.Boolean; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/options/channel.ts +import { ApplicationCommandOptionType as ApplicationCommandOptionType3 } from "discord-api-types/v10"; +import { mix } from "ts-mixer"; + +// src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts +import { s as s6 } from "@sapphire/shapeshift"; +import { ChannelType as ChannelType2 } from "discord-api-types/v10"; +var allowedChannelTypes = [ + ChannelType2.GuildText, + ChannelType2.GuildVoice, + ChannelType2.GuildCategory, + ChannelType2.GuildAnnouncement, + ChannelType2.AnnouncementThread, + ChannelType2.PublicThread, + ChannelType2.PrivateThread, + ChannelType2.GuildStageVoice, + ChannelType2.GuildForum, + ChannelType2.GuildMedia +]; +var channelTypesPredicate = s6.array(s6.union(...allowedChannelTypes.map((type) => s6.literal(type)))); +var ApplicationCommandOptionChannelTypesMixin = class { + static { + __name(this, "ApplicationCommandOptionChannelTypesMixin"); + } + /** + * The channel types of this option. + */ + channel_types; + /** + * Adds channel types to this option. + * + * @param channelTypes - The channel types + */ + addChannelTypes(...channelTypes) { + if (this.channel_types === void 0) { + Reflect.set(this, "channel_types", []); + } + this.channel_types.push(...channelTypesPredicate.parse(channelTypes)); + return this; + } +}; + +// src/interactions/slashCommands/options/channel.ts +var SlashCommandChannelOption = class extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + type = ApplicationCommandOptionType3.Channel; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; +__name(SlashCommandChannelOption, "SlashCommandChannelOption"); +SlashCommandChannelOption = __decorateClass([ + mix(ApplicationCommandOptionChannelTypesMixin) +], SlashCommandChannelOption); + +// src/interactions/slashCommands/options/integer.ts +import { s as s8 } from "@sapphire/shapeshift"; +import { ApplicationCommandOptionType as ApplicationCommandOptionType5 } from "discord-api-types/v10"; +import { mix as mix2 } from "ts-mixer"; + +// src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts +var ApplicationCommandNumericOptionMinMaxValueMixin = class { + static { + __name(this, "ApplicationCommandNumericOptionMinMaxValueMixin"); + } + /** + * The maximum value of this option. + */ + max_value; + /** + * The minimum value of this option. + */ + min_value; +}; + +// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts +import { s as s7 } from "@sapphire/shapeshift"; +import { ApplicationCommandOptionType as ApplicationCommandOptionType4 } from "discord-api-types/v10"; +var stringPredicate = s7.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100); +var numberPredicate = s7.number.greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY); +var choicesPredicate = s7.object({ + name: stringPredicate, + name_localizations: localizationMapPredicate, + value: s7.union(stringPredicate, numberPredicate) +}).array; +var booleanPredicate2 = s7.boolean; +var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class { + static { + __name(this, "ApplicationCommandOptionWithChoicesAndAutocompleteMixin"); + } + /** + * The choices of this option. + */ + choices; + /** + * Whether this option utilizes autocomplete. + */ + autocomplete; + /** + * The type of this option. + * + * @privateRemarks Since this is present and this is a mixin, this is needed. + */ + type; + /** + * Adds multiple choices to this option. + * + * @param choices - The choices to add + */ + addChoices(...choices) { + if (choices.length > 0 && this.autocomplete) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + choicesPredicate.parse(choices); + if (this.choices === void 0) { + Reflect.set(this, "choices", []); + } + validateChoicesLength(choices.length, this.choices); + for (const { name, name_localizations, value } of choices) { + if (this.type === ApplicationCommandOptionType4.String) { + stringPredicate.parse(value); + } else { + numberPredicate.parse(value); + } + this.choices.push({ name, name_localizations, value }); + } + return this; + } + /** + * Sets multiple choices for this option. + * + * @param choices - The choices to set + */ + setChoices(...choices) { + if (choices.length > 0 && this.autocomplete) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + choicesPredicate.parse(choices); + Reflect.set(this, "choices", []); + this.addChoices(...choices); + return this; + } + /** + * Whether this option uses autocomplete. + * + * @param autocomplete - Whether this option should use autocomplete + */ + setAutocomplete(autocomplete) { + booleanPredicate2.parse(autocomplete); + if (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + Reflect.set(this, "autocomplete", autocomplete); + return this; + } +}; + +// src/interactions/slashCommands/options/integer.ts +var numberValidator = s8.number.int; +var SlashCommandIntegerOption = class extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + type = ApplicationCommandOptionType5.Integer; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue} + */ + setMaxValue(max) { + numberValidator.parse(max); + Reflect.set(this, "max_value", max); + return this; + } + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue} + */ + setMinValue(min) { + numberValidator.parse(min); + Reflect.set(this, "min_value", min); + return this; + } + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + return { ...this }; + } +}; +__name(SlashCommandIntegerOption, "SlashCommandIntegerOption"); +SlashCommandIntegerOption = __decorateClass([ + mix2(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin) +], SlashCommandIntegerOption); + +// src/interactions/slashCommands/options/mentionable.ts +import { ApplicationCommandOptionType as ApplicationCommandOptionType6 } from "discord-api-types/v10"; +var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandMentionableOption"); + } + /** + * The type of this option. + */ + type = ApplicationCommandOptionType6.Mentionable; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/options/number.ts +import { s as s9 } from "@sapphire/shapeshift"; +import { ApplicationCommandOptionType as ApplicationCommandOptionType7 } from "discord-api-types/v10"; +import { mix as mix3 } from "ts-mixer"; +var numberValidator2 = s9.number; +var SlashCommandNumberOption = class extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + type = ApplicationCommandOptionType7.Number; + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue} + */ + setMaxValue(max) { + numberValidator2.parse(max); + Reflect.set(this, "max_value", max); + return this; + } + /** + * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue} + */ + setMinValue(min) { + numberValidator2.parse(min); + Reflect.set(this, "min_value", min); + return this; + } + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + return { ...this }; + } +}; +__name(SlashCommandNumberOption, "SlashCommandNumberOption"); +SlashCommandNumberOption = __decorateClass([ + mix3(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin) +], SlashCommandNumberOption); + +// src/interactions/slashCommands/options/role.ts +import { ApplicationCommandOptionType as ApplicationCommandOptionType8 } from "discord-api-types/v10"; +var SlashCommandRoleOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandRoleOption"); + } + /** + * The type of this option. + */ + type = ApplicationCommandOptionType8.Role; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/options/string.ts +import { s as s10 } from "@sapphire/shapeshift"; +import { ApplicationCommandOptionType as ApplicationCommandOptionType9 } from "discord-api-types/v10"; +import { mix as mix4 } from "ts-mixer"; +var minLengthValidator2 = s10.number.greaterThanOrEqual(0).lessThanOrEqual(6e3); +var maxLengthValidator2 = s10.number.greaterThanOrEqual(1).lessThanOrEqual(6e3); +var SlashCommandStringOption = class extends ApplicationCommandOptionBase { + /** + * The type of this option. + */ + type = ApplicationCommandOptionType9.String; + /** + * The maximum length of this option. + */ + max_length; + /** + * The minimum length of this option. + */ + min_length; + /** + * Sets the maximum length of this string option. + * + * @param max - The maximum length this option can be + */ + setMaxLength(max) { + maxLengthValidator2.parse(max); + Reflect.set(this, "max_length", max); + return this; + } + /** + * Sets the minimum length of this string option. + * + * @param min - The minimum length this option can be + */ + setMinLength(min) { + minLengthValidator2.parse(min); + Reflect.set(this, "min_length", min); + return this; + } + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + if (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) { + throw new RangeError("Autocomplete and choices are mutually exclusive to each other."); + } + return { ...this }; + } +}; +__name(SlashCommandStringOption, "SlashCommandStringOption"); +SlashCommandStringOption = __decorateClass([ + mix4(ApplicationCommandOptionWithChoicesAndAutocompleteMixin) +], SlashCommandStringOption); + +// src/interactions/slashCommands/options/user.ts +import { ApplicationCommandOptionType as ApplicationCommandOptionType10 } from "discord-api-types/v10"; +var SlashCommandUserOption = class extends ApplicationCommandOptionBase { + static { + __name(this, "SlashCommandUserOption"); + } + /** + * The type of this option. + */ + type = ApplicationCommandOptionType10.User; + /** + * {@inheritDoc ApplicationCommandOptionBase.toJSON} + */ + toJSON() { + this.runRequiredValidations(); + return { ...this }; + } +}; + +// src/interactions/slashCommands/mixins/SharedSlashCommandOptions.ts +var SharedSlashCommandOptions = class { + static { + __name(this, "SharedSlashCommandOptions"); + } + options; + /** + * Adds a boolean option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addBooleanOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandBooleanOption); + } + /** + * Adds a user option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addUserOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandUserOption); + } + /** + * Adds a channel option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addChannelOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandChannelOption); + } + /** + * Adds a role option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addRoleOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandRoleOption); + } + /** + * Adds an attachment option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addAttachmentOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandAttachmentOption); + } + /** + * Adds a mentionable option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addMentionableOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandMentionableOption); + } + /** + * Adds a string option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addStringOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandStringOption); + } + /** + * Adds an integer option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addIntegerOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandIntegerOption); + } + /** + * Adds a number option. + * + * @param input - A function that returns an option builder or an already built builder + */ + addNumberOption(input) { + return this._sharedAddOptionMethod(input, SlashCommandNumberOption); + } + /** + * Where the actual adding magic happens. ✨ + * + * @param input - The input. What else? + * @param Instance - The instance of whatever is being added + * @internal + */ + _sharedAddOptionMethod(input, Instance) { + const { options } = this; + validateMaxOptionsLength(options); + const result = typeof input === "function" ? input(new Instance()) : input; + assertReturnOfBuilder(result, Instance); + options.push(result); + return this; + } +}; + +// src/interactions/slashCommands/SlashCommandSubcommands.ts +var SlashCommandSubcommandGroupBuilder = class { + /** + * The name of this subcommand group. + */ + name = void 0; + /** + * The description of this subcommand group. + */ + description = void 0; + /** + * The subcommands within this subcommand group. + */ + options = []; + /** + * Adds a new subcommand to this group. + * + * @param input - A function that returns a subcommand builder or an already built builder + */ + addSubcommand(input) { + const { options } = this; + validateMaxOptionsLength(options); + const result = typeof input === "function" ? input(new SlashCommandSubcommandBuilder()) : input; + assertReturnOfBuilder(result, SlashCommandSubcommandBuilder); + options.push(result); + return this; + } + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + validateRequiredParameters3(this.name, this.description, this.options); + return { + type: ApplicationCommandOptionType11.SubcommandGroup, + name: this.name, + name_localizations: this.name_localizations, + description: this.description, + description_localizations: this.description_localizations, + options: this.options.map((option) => option.toJSON()) + }; + } +}; +__name(SlashCommandSubcommandGroupBuilder, "SlashCommandSubcommandGroupBuilder"); +SlashCommandSubcommandGroupBuilder = __decorateClass([ + mix5(SharedNameAndDescription) +], SlashCommandSubcommandGroupBuilder); +var SlashCommandSubcommandBuilder = class { + /** + * The name of this subcommand. + */ + name = void 0; + /** + * The description of this subcommand. + */ + description = void 0; + /** + * The options within this subcommand. + */ + options = []; + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + validateRequiredParameters3(this.name, this.description, this.options); + return { + type: ApplicationCommandOptionType11.Subcommand, + name: this.name, + name_localizations: this.name_localizations, + description: this.description, + description_localizations: this.description_localizations, + options: this.options.map((option) => option.toJSON()) + }; + } +}; +__name(SlashCommandSubcommandBuilder, "SlashCommandSubcommandBuilder"); +SlashCommandSubcommandBuilder = __decorateClass([ + mix5(SharedNameAndDescription, SharedSlashCommandOptions) +], SlashCommandSubcommandBuilder); + +// src/interactions/slashCommands/SlashCommandBuilder.ts +var SlashCommandBuilder = class { + /** + * The name of this command. + */ + name = void 0; + /** + * The name localizations of this command. + */ + name_localizations; + /** + * The description of this command. + */ + description = void 0; + /** + * The description localizations of this command. + */ + description_localizations; + /** + * The options of this command. + */ + options = []; + /** + * Whether this command is enabled by default when the application is added to a guild. + * + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + default_permission = void 0; + /** + * The set of permissions represented as a bit set for the command. + */ + default_member_permissions = void 0; + /** + * Indicates whether the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This property is only for global commands. + */ + dm_permission = void 0; + /** + * Whether this command is NSFW. + */ + nsfw = void 0; + /** + * Sets whether the command is enabled by default when the application is added to a guild. + * + * @remarks + * If set to `false`, you will have to later `PUT` the permissions for this command. + * @param value - Whether or not to enable this command by default + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + * @deprecated Use {@link SlashCommandBuilder.setDefaultMemberPermissions} or {@link SlashCommandBuilder.setDMPermission} instead. + */ + setDefaultPermission(value) { + validateDefaultPermission(value); + Reflect.set(this, "default_permission", value); + return this; + } + /** + * Sets the default permissions a member should have in order to run the command. + * + * @remarks + * You can set this to `'0'` to disable the command by default. + * @param permissions - The permissions bit field to set + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDefaultMemberPermissions(permissions) { + const permissionValue = validateDefaultMemberPermissions(permissions); + Reflect.set(this, "default_member_permissions", permissionValue); + return this; + } + /** + * Sets if the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This method is only for global commands. + * @param enabled - Whether the command should be enabled in direct messages + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDMPermission(enabled) { + validateDMPermission(enabled); + Reflect.set(this, "dm_permission", enabled); + return this; + } + /** + * Sets whether this command is NSFW. + * + * @param nsfw - Whether this command is NSFW + */ + setNSFW(nsfw = true) { + validateNSFW(nsfw); + Reflect.set(this, "nsfw", nsfw); + return this; + } + /** + * 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; + validateMaxOptionsLength(options); + const result = typeof input === "function" ? input(new SlashCommandSubcommandGroupBuilder()) : input; + assertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder); + options.push(result); + return this; + } + /** + * Adds a new subcommand to this command. + * + * @param input - A function that returns a subcommand builder or an already built builder + */ + addSubcommand(input) { + const { options } = this; + validateMaxOptionsLength(options); + const result = typeof input === "function" ? input(new SlashCommandSubcommandBuilder()) : input; + assertReturnOfBuilder(result, SlashCommandSubcommandBuilder); + options.push(result); + return this; + } + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + validateRequiredParameters3(this.name, this.description, this.options); + validateLocalizationMap(this.name_localizations); + validateLocalizationMap(this.description_localizations); + return { + ...this, + options: this.options.map((option) => option.toJSON()) + }; + } +}; +__name(SlashCommandBuilder, "SlashCommandBuilder"); +SlashCommandBuilder = __decorateClass([ + mix6(SharedSlashCommandOptions, SharedNameAndDescription) +], SlashCommandBuilder); + +// src/interactions/contextMenuCommands/Assertions.ts +var Assertions_exports6 = {}; +__export(Assertions_exports6, { + validateDMPermission: () => validateDMPermission2, + validateDefaultMemberPermissions: () => validateDefaultMemberPermissions2, + validateDefaultPermission: () => validateDefaultPermission2, + validateName: () => validateName2, + validateRequiredParameters: () => validateRequiredParameters4, + validateType: () => validateType +}); +import { s as s11 } from "@sapphire/shapeshift"; +import { ApplicationCommandType } from "discord-api-types/v10"; +var namePredicate2 = s11.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^( *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}]+ *)+$/u).setValidationEnabled(isValidationEnabled); +var typePredicate = s11.union(s11.literal(ApplicationCommandType.User), s11.literal(ApplicationCommandType.Message)).setValidationEnabled(isValidationEnabled); +var booleanPredicate3 = s11.boolean; +function validateDefaultPermission2(value) { + booleanPredicate3.parse(value); +} +__name(validateDefaultPermission2, "validateDefaultPermission"); +function validateName2(name) { + namePredicate2.parse(name); +} +__name(validateName2, "validateName"); +function validateType(type) { + typePredicate.parse(type); +} +__name(validateType, "validateType"); +function validateRequiredParameters4(name, type) { + validateName2(name); + validateType(type); +} +__name(validateRequiredParameters4, "validateRequiredParameters"); +var dmPermissionPredicate2 = s11.boolean.nullish; +function validateDMPermission2(value) { + dmPermissionPredicate2.parse(value); +} +__name(validateDMPermission2, "validateDMPermission"); +var memberPermissionPredicate2 = s11.union( + s11.bigint.transform((value) => value.toString()), + s11.number.safeInt.transform((value) => value.toString()), + s11.string.regex(/^\d+$/) +).nullish; +function validateDefaultMemberPermissions2(permissions) { + return memberPermissionPredicate2.parse(permissions); +} +__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions"); + +// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts +var ContextMenuCommandBuilder = class { + static { + __name(this, "ContextMenuCommandBuilder"); + } + /** + * The name of this command. + */ + name = void 0; + /** + * The name localizations of this command. + */ + name_localizations; + /** + * The type of this command. + */ + type = void 0; + /** + * Whether this command is enabled by default when the application is added to a guild. + * + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + default_permission = void 0; + /** + * The set of permissions represented as a bit set for the command. + */ + default_member_permissions = void 0; + /** + * Indicates whether the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This property is only for global commands. + */ + dm_permission = void 0; + /** + * Sets the name of this command. + * + * @param name - The name to use + */ + setName(name) { + validateName2(name); + Reflect.set(this, "name", name); + return this; + } + /** + * Sets the type of this command. + * + * @param type - The type to use + */ + setType(type) { + validateType(type); + Reflect.set(this, "type", type); + return this; + } + /** + * Sets whether the command is enabled by default when the application is added to a guild. + * + * @remarks + * If set to `false`, you will have to later `PUT` the permissions for this command. + * @param value - Whether to enable this command by default + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead. + */ + setDefaultPermission(value) { + validateDefaultPermission2(value); + Reflect.set(this, "default_permission", value); + return this; + } + /** + * Sets the default permissions a member should have in order to run this command. + * + * @remarks + * You can set this to `'0'` to disable the command by default. + * @param permissions - The permissions bit field to set + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDefaultMemberPermissions(permissions) { + const permissionValue = validateDefaultMemberPermissions2(permissions); + Reflect.set(this, "default_member_permissions", permissionValue); + return this; + } + /** + * Sets if the command is available in direct messages with the application. + * + * @remarks + * By default, commands are visible. This method is only for global commands. + * @param enabled - Whether the command should be enabled in direct messages + * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions} + */ + setDMPermission(enabled) { + validateDMPermission2(enabled); + Reflect.set(this, "dm_permission", enabled); + return this; + } + /** + * Sets a name localization for this command. + * + * @param locale - The locale to set + * @param localizedName - The localized name for the given `locale` + */ + setNameLocalization(locale, localizedName) { + if (!this.name_localizations) { + Reflect.set(this, "name_localizations", {}); + } + const parsedLocale = validateLocale(locale); + if (localizedName === null) { + this.name_localizations[parsedLocale] = null; + return this; + } + validateName2(localizedName); + this.name_localizations[parsedLocale] = localizedName; + return this; + } + /** + * Sets the name localizations for this command. + * + * @param localizedNames - The object of localized names to set + */ + setNameLocalizations(localizedNames) { + if (localizedNames === null) { + Reflect.set(this, "name_localizations", null); + return this; + } + Reflect.set(this, "name_localizations", {}); + for (const args of Object.entries(localizedNames)) + this.setNameLocalization(...args); + return this; + } + /** + * Serializes this builder to API-compatible JSON data. + * + * @remarks + * This method runs validations on the data before serializing it. + * As such, it may throw an error if the data is invalid. + */ + toJSON() { + validateRequiredParameters4(this.name, this.type); + validateLocalizationMap(this.name_localizations); + return { ...this }; + } +}; + +// src/util/componentUtil.ts +function embedLength(data) { + return (data.title?.length ?? 0) + (data.description?.length ?? 0) + (data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) + (data.footer?.text.length ?? 0) + (data.author?.name.length ?? 0); +} +__name(embedLength, "embedLength"); + +// src/index.ts +var version = "1.7.0"; +export { + ActionRowBuilder, + ApplicationCommandNumericOptionMinMaxValueMixin, + ApplicationCommandOptionBase, + ApplicationCommandOptionChannelTypesMixin, + ApplicationCommandOptionWithChoicesAndAutocompleteMixin, + BaseSelectMenuBuilder, + ButtonBuilder, + ChannelSelectMenuBuilder, + Assertions_exports2 as ComponentAssertions, + ComponentBuilder, + Assertions_exports6 as ContextMenuCommandAssertions, + ContextMenuCommandBuilder, + Assertions_exports as EmbedAssertions, + EmbedBuilder, + MentionableSelectMenuBuilder, + Assertions_exports4 as ModalAssertions, + ModalBuilder, + RoleSelectMenuBuilder, + StringSelectMenuBuilder as SelectMenuBuilder, + StringSelectMenuOptionBuilder as SelectMenuOptionBuilder, + SharedNameAndDescription, + SharedSlashCommandOptions, + Assertions_exports5 as SlashCommandAssertions, + SlashCommandAttachmentOption, + SlashCommandBooleanOption, + SlashCommandBuilder, + SlashCommandChannelOption, + SlashCommandIntegerOption, + SlashCommandMentionableOption, + SlashCommandNumberOption, + SlashCommandRoleOption, + SlashCommandStringOption, + SlashCommandSubcommandBuilder, + SlashCommandSubcommandGroupBuilder, + SlashCommandUserOption, + StringSelectMenuBuilder, + StringSelectMenuOptionBuilder, + Assertions_exports3 as TextInputAssertions, + TextInputBuilder, + UserSelectMenuBuilder, + createComponentBuilder, + disableValidators, + embedLength, + enableValidators, + isValidationEnabled, + normalizeArray, + version +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/node_modules/@discordjs/builders/dist/index.mjs.map b/node_modules/@discordjs/builders/dist/index.mjs.map new file mode 100644 index 0000000..41f5954 --- /dev/null +++ b/node_modules/@discordjs/builders/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/messages/embed/Assertions.ts","../src/util/validation.ts","../src/util/normalizeArray.ts","../src/messages/embed/Embed.ts","../src/index.ts","../src/components/Assertions.ts","../src/components/selectMenu/StringSelectMenuOption.ts","../src/components/ActionRow.ts","../src/components/Component.ts","../src/components/Components.ts","../src/components/button/Button.ts","../src/components/selectMenu/ChannelSelectMenu.ts","../src/components/selectMenu/BaseSelectMenu.ts","../src/components/selectMenu/MentionableSelectMenu.ts","../src/components/selectMenu/RoleSelectMenu.ts","../src/components/selectMenu/StringSelectMenu.ts","../src/components/selectMenu/UserSelectMenu.ts","../src/components/textInput/TextInput.ts","../src/components/textInput/Assertions.ts","../src/interactions/modals/Assertions.ts","../src/interactions/modals/Modal.ts","../src/interactions/slashCommands/Assertions.ts","../src/interactions/slashCommands/SlashCommandBuilder.ts","../src/interactions/slashCommands/SlashCommandSubcommands.ts","../src/interactions/slashCommands/mixins/NameAndDescription.ts","../src/interactions/slashCommands/options/attachment.ts","../src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts","../src/interactions/slashCommands/options/boolean.ts","../src/interactions/slashCommands/options/channel.ts","../src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts","../src/interactions/slashCommands/options/integer.ts","../src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts","../src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts","../src/interactions/slashCommands/options/mentionable.ts","../src/interactions/slashCommands/options/number.ts","../src/interactions/slashCommands/options/role.ts","../src/interactions/slashCommands/options/string.ts","../src/interactions/slashCommands/options/user.ts","../src/interactions/slashCommands/mixins/SharedSlashCommandOptions.ts","../src/interactions/contextMenuCommands/Assertions.ts","../src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts","../src/util/componentUtil.ts"],"sourcesContent":["import { s } from '@sapphire/shapeshift';\nimport type { APIEmbedField } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../../util/validation.js';\n\nexport const fieldNamePredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(256)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const fieldValuePredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(1_024)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const fieldInlinePredicate = s.boolean.optional;\n\nexport const embedFieldPredicate = s\n\t.object({\n\t\tname: fieldNamePredicate,\n\t\tvalue: fieldValuePredicate,\n\t\tinline: fieldInlinePredicate,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const embedFieldsArrayPredicate = embedFieldPredicate.array.setValidationEnabled(isValidationEnabled);\n\nexport const fieldLengthPredicate = s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);\n\nexport function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void {\n\tfieldLengthPredicate.parse((fields?.length ?? 0) + amountAdding);\n}\n\nexport const authorNamePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);\n\nexport const imageURLPredicate = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:', 'attachment:'],\n\t})\n\t.nullish.setValidationEnabled(isValidationEnabled);\n\nexport const urlPredicate = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:'],\n\t})\n\t.nullish.setValidationEnabled(isValidationEnabled);\n\nexport const embedAuthorPredicate = s\n\t.object({\n\t\tname: authorNamePredicate,\n\t\ticonURL: imageURLPredicate,\n\t\turl: urlPredicate,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const RGBPredicate = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(255)\n\t.setValidationEnabled(isValidationEnabled);\nexport const colorPredicate = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(0xffffff)\n\t.or(s.tuple([RGBPredicate, RGBPredicate, RGBPredicate]))\n\t.nullable.setValidationEnabled(isValidationEnabled);\n\nexport const descriptionPredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(4_096)\n\t.nullable.setValidationEnabled(isValidationEnabled);\n\nexport const footerTextPredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(2_048)\n\t.nullable.setValidationEnabled(isValidationEnabled);\n\nexport const embedFooterPredicate = s\n\t.object({\n\t\ttext: footerTextPredicate,\n\t\ticonURL: imageURLPredicate,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const timestampPredicate = s.union(s.number, s.date).nullable.setValidationEnabled(isValidationEnabled);\n\nexport const titlePredicate = fieldNamePredicate.nullable.setValidationEnabled(isValidationEnabled);\n","let validate = true;\n\n/**\n * Enables validators.\n *\n * @returns Whether validation is occurring.\n */\nexport function enableValidators() {\n\treturn (validate = true);\n}\n\n/**\n * Disables validators.\n *\n * @returns Whether validation is occurring.\n */\nexport function disableValidators() {\n\treturn (validate = false);\n}\n\n/**\n * Checks whether validation is occurring.\n */\nexport function isValidationEnabled() {\n\treturn validate;\n}\n","/**\n * Normalizes data that is a rest parameter or an array into an array with a depth of 1.\n *\n * @typeParam ItemType - The data that must satisfy {@link RestOrArray}.\n * @param arr - The (possibly variadic) data to normalize\n */\nexport function normalizeArray(arr: RestOrArray): ItemType[] {\n\tif (Array.isArray(arr[0])) return arr[0];\n\treturn arr as ItemType[];\n}\n\n/**\n * Represents data that may be an array or came from a rest parameter.\n *\n * @remarks\n * This type is used throughout builders to ensure both an array and variadic arguments\n * may be used. It is normalized with {@link normalizeArray}.\n */\nexport type RestOrArray = Type[] | [Type[]];\n","import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage } from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray.js';\nimport {\n\tcolorPredicate,\n\tdescriptionPredicate,\n\tembedAuthorPredicate,\n\tembedFieldsArrayPredicate,\n\tembedFooterPredicate,\n\timageURLPredicate,\n\ttimestampPredicate,\n\ttitlePredicate,\n\turlPredicate,\n\tvalidateFieldLength,\n} from './Assertions.js';\n\n/**\n * A tuple satisfying the RGB color model.\n *\n * @see {@link https://developer.mozilla.org/docs/Glossary/RGB}\n */\nexport type RGBTuple = [red: number, green: number, blue: number];\n\n/**\n * The base icon data typically used in payloads.\n */\nexport interface IconData {\n\t/**\n\t * The URL of the icon.\n\t */\n\ticonURL?: string;\n\t/**\n\t * The proxy URL of the icon.\n\t */\n\tproxyIconURL?: string;\n}\n\n/**\n * Represents the author data of an embed.\n */\nexport type EmbedAuthorData = IconData & Omit;\n\n/**\n * Represents the author options of an embed.\n */\nexport type EmbedAuthorOptions = Omit;\n\n/**\n * Represents the footer data of an embed.\n */\nexport type EmbedFooterData = IconData & Omit;\n\n/**\n * Represents the footer options of an embed.\n */\nexport type EmbedFooterOptions = Omit;\n\n/**\n * Represents the image data of an embed.\n */\nexport interface EmbedImageData extends Omit {\n\t/**\n\t * The proxy URL for the image.\n\t */\n\tproxyURL?: string;\n}\n\n/**\n * A builder that creates API-compatible JSON data for embeds.\n */\nexport class EmbedBuilder {\n\t/**\n\t * The API data associated with this embed.\n\t */\n\tpublic readonly data: APIEmbed;\n\n\t/**\n\t * Creates a new embed from API data.\n\t *\n\t * @param data - The API data to create this embed with\n\t */\n\tpublic constructor(data: APIEmbed = {}) {\n\t\tthis.data = { ...data };\n\t\tif (data.timestamp) this.data.timestamp = new Date(data.timestamp).toISOString();\n\t}\n\n\t/**\n\t * Appends fields to the embed.\n\t *\n\t * @remarks\n\t * This method accepts either an array of fields or a variable number of field parameters.\n\t * The maximum amount of fields that can be added is 25.\n\t * @example\n\t * Using an array:\n\t * ```ts\n\t * const fields: APIEmbedField[] = ...;\n\t * const embed = new EmbedBuilder()\n\t * \t.addFields(fields);\n\t * ```\n\t * @example\n\t * Using rest parameters (variadic):\n\t * ```ts\n\t * const embed = new EmbedBuilder()\n\t * \t.addFields(\n\t * \t\t{ name: 'Field 1', value: 'Value 1' },\n\t * \t\t{ name: 'Field 2', value: 'Value 2' },\n\t * \t);\n\t * ```\n\t * @param fields - The fields to add\n\t */\n\tpublic addFields(...fields: RestOrArray): this {\n\t\tconst normalizedFields = normalizeArray(fields);\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(normalizedFields.length, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(normalizedFields);\n\n\t\tif (this.data.fields) this.data.fields.push(...normalizedFields);\n\t\telse this.data.fields = normalizedFields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts fields for this embed.\n\t *\n\t * @remarks\n\t * This method behaves similarly\n\t * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.\n\t * The maximum amount of fields that can be added is 25.\n\t *\n\t * It's useful for modifying and adjusting order of the already-existing fields of an embed.\n\t * @example\n\t * Remove the first field:\n\t * ```ts\n\t * embed.spliceFields(0, 1);\n\t * ```\n\t * @example\n\t * Remove the first n fields:\n\t * ```ts\n\t * const n = 4;\n\t * embed.spliceFields(0, n);\n\t * ```\n\t * @example\n\t * Remove the last field:\n\t * ```ts\n\t * embed.spliceFields(-1, 1);\n\t * ```\n\t * @param index - The index to start at\n\t * @param deleteCount - The number of fields to remove\n\t * @param fields - The replacing field objects\n\t */\n\tpublic spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this {\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length - deleteCount, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\t\tif (this.data.fields) this.data.fields.splice(index, deleteCount, ...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the fields for this embed.\n\t *\n\t * @remarks\n\t * This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically,\n\t * it splices the entire array of fields, replacing them with the provided fields.\n\t *\n\t * You can set a maximum of 25 fields.\n\t * @param fields - The fields to set\n\t */\n\tpublic setFields(...fields: RestOrArray) {\n\t\tthis.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the author of this embed.\n\t *\n\t * @param options - The options to use\n\t */\n\n\tpublic setAuthor(options: EmbedAuthorOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.author = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedAuthorPredicate.parse(options);\n\n\t\tthis.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the color of this embed.\n\t *\n\t * @param color - The color to use\n\t */\n\tpublic setColor(color: RGBTuple | number | null): this {\n\t\t// Data assertions\n\t\tcolorPredicate.parse(color);\n\n\t\tif (Array.isArray(color)) {\n\t\t\tconst [red, green, blue] = color;\n\t\t\tthis.data.color = (red << 16) + (green << 8) + blue;\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.data.color = color ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this embed.\n\t *\n\t * @param description - The description to use\n\t */\n\tpublic setDescription(description: string | null): this {\n\t\t// Data assertions\n\t\tdescriptionPredicate.parse(description);\n\n\t\tthis.data.description = description ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the footer of this embed.\n\t *\n\t * @param options - The footer to use\n\t */\n\tpublic setFooter(options: EmbedFooterOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.footer = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedFooterPredicate.parse(options);\n\n\t\tthis.data.footer = { text: options.text, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the image of this embed.\n\t *\n\t * @param url - The image URL to use\n\t */\n\tpublic setImage(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.image = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the thumbnail of this embed.\n\t *\n\t * @param url - The thumbnail URL to use\n\t */\n\tpublic setThumbnail(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.thumbnail = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the timestamp of this embed.\n\t *\n\t * @param timestamp - The timestamp or date to use\n\t */\n\tpublic setTimestamp(timestamp: Date | number | null = Date.now()): this {\n\t\t// Data assertions\n\t\ttimestampPredicate.parse(timestamp);\n\n\t\tthis.data.timestamp = timestamp ? new Date(timestamp).toISOString() : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the title for this embed.\n\t *\n\t * @param title - The title to use\n\t */\n\tpublic setTitle(title: string | null): this {\n\t\t// Data assertions\n\t\ttitlePredicate.parse(title);\n\n\t\tthis.data.title = title ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL of this embed.\n\t *\n\t * @param url - The URL to use\n\t */\n\tpublic setURL(url: string | null): this {\n\t\t// Data assertions\n\t\turlPredicate.parse(url);\n\n\t\tthis.data.url = url ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): APIEmbed {\n\t\treturn { ...this.data };\n\t}\n}\n","export * as EmbedAssertions from './messages/embed/Assertions.js';\nexport * from './messages/embed/Embed.js';\n// TODO: Consider removing this dep in the next major version\nexport * from '@discordjs/formatters';\n\nexport * as ComponentAssertions from './components/Assertions.js';\nexport * from './components/ActionRow.js';\nexport * from './components/button/Button.js';\nexport * from './components/Component.js';\nexport * from './components/Components.js';\nexport * from './components/textInput/TextInput.js';\nexport * as TextInputAssertions from './components/textInput/Assertions.js';\nexport * from './interactions/modals/Modal.js';\nexport * as ModalAssertions from './interactions/modals/Assertions.js';\n\nexport * from './components/selectMenu/BaseSelectMenu.js';\nexport * from './components/selectMenu/ChannelSelectMenu.js';\nexport * from './components/selectMenu/MentionableSelectMenu.js';\nexport * from './components/selectMenu/RoleSelectMenu.js';\nexport * from './components/selectMenu/StringSelectMenu.js';\n// TODO: Remove those aliases in v2\nexport {\n\t/**\n\t * @deprecated Will be removed in the next major version, use {@link StringSelectMenuBuilder} instead.\n\t */\n\tStringSelectMenuBuilder as SelectMenuBuilder,\n} from './components/selectMenu/StringSelectMenu.js';\nexport {\n\t/**\n\t * @deprecated Will be removed in the next major version, use {@link StringSelectMenuOptionBuilder} instead.\n\t */\n\tStringSelectMenuOptionBuilder as SelectMenuOptionBuilder,\n} from './components/selectMenu/StringSelectMenuOption.js';\nexport * from './components/selectMenu/StringSelectMenuOption.js';\nexport * from './components/selectMenu/UserSelectMenu.js';\n\nexport * as SlashCommandAssertions from './interactions/slashCommands/Assertions.js';\nexport * from './interactions/slashCommands/SlashCommandBuilder.js';\nexport * from './interactions/slashCommands/SlashCommandSubcommands.js';\nexport * from './interactions/slashCommands/options/boolean.js';\nexport * from './interactions/slashCommands/options/channel.js';\nexport * from './interactions/slashCommands/options/integer.js';\nexport * from './interactions/slashCommands/options/mentionable.js';\nexport * from './interactions/slashCommands/options/number.js';\nexport * from './interactions/slashCommands/options/role.js';\nexport * from './interactions/slashCommands/options/attachment.js';\nexport * from './interactions/slashCommands/options/string.js';\nexport * from './interactions/slashCommands/options/user.js';\nexport * from './interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.js';\nexport * from './interactions/slashCommands/mixins/ApplicationCommandOptionBase.js';\nexport * from './interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.js';\nexport * from './interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.js';\nexport * from './interactions/slashCommands/mixins/NameAndDescription.js';\nexport * from './interactions/slashCommands/mixins/SharedSlashCommandOptions.js';\n\nexport * as ContextMenuCommandAssertions from './interactions/contextMenuCommands/Assertions.js';\nexport * from './interactions/contextMenuCommands/ContextMenuCommandBuilder.js';\n\nexport * from './util/componentUtil.js';\nexport * from './util/normalizeArray.js';\nexport * from './util/validation.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/builders#readme | @discordjs/builders} version\n * that you are currently using.\n *\n * @privateRemarks This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild.\n */\nexport const version = '1.7.0' as string;\n","import { s } from '@sapphire/shapeshift';\nimport { ButtonStyle, ChannelType, type APIMessageComponentEmoji } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../util/validation.js';\nimport { StringSelectMenuOptionBuilder } from './selectMenu/StringSelectMenuOption.js';\n\nexport const customIdValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const emojiValidator = s\n\t.object({\n\t\tid: s.string,\n\t\tname: s.string,\n\t\tanimated: s.boolean,\n\t})\n\t.partial.strict.setValidationEnabled(isValidationEnabled);\n\nexport const disabledValidator = s.boolean;\n\nexport const buttonLabelValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(80)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const buttonStyleValidator = s.nativeEnum(ButtonStyle);\n\nexport const placeholderValidator = s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);\nexport const minMaxValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const labelValueDescriptionValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const jsonOptionValidator = s\n\t.object({\n\t\tlabel: labelValueDescriptionValidator,\n\t\tvalue: labelValueDescriptionValidator,\n\t\tdescription: labelValueDescriptionValidator.optional,\n\t\temoji: emojiValidator.optional,\n\t\tdefault: s.boolean.optional,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const optionValidator = s.instance(StringSelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);\n\nexport const optionsValidator = optionValidator.array\n\t.lengthGreaterThanOrEqual(0)\n\t.setValidationEnabled(isValidationEnabled);\nexport const optionsLengthValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredSelectMenuParameters(options: StringSelectMenuOptionBuilder[], customId?: string) {\n\tcustomIdValidator.parse(customId);\n\toptionsValidator.parse(options);\n}\n\nexport const defaultValidator = s.boolean;\n\nexport function validateRequiredSelectMenuOptionParameters(label?: string, value?: string) {\n\tlabelValueDescriptionValidator.parse(label);\n\tlabelValueDescriptionValidator.parse(value);\n}\n\nexport const channelTypesValidator = s.nativeEnum(ChannelType).array.setValidationEnabled(isValidationEnabled);\n\nexport const urlValidator = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:', 'discord:'],\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredButtonParameters(\n\tstyle?: ButtonStyle,\n\tlabel?: string,\n\temoji?: APIMessageComponentEmoji,\n\tcustomId?: string,\n\turl?: string,\n) {\n\tif (url && customId) {\n\t\tthrow new RangeError('URL and custom id are mutually exclusive');\n\t}\n\n\tif (!label && !emoji) {\n\t\tthrow new RangeError('Buttons must have a label and/or an emoji');\n\t}\n\n\tif (style === ButtonStyle.Link) {\n\t\tif (!url) {\n\t\t\tthrow new RangeError('Link buttons must have a url');\n\t\t}\n\t} else if (url) {\n\t\tthrow new RangeError('Non-link buttons cannot have a url');\n\t}\n}\n","import type { JSONEncodable } from '@discordjs/util';\nimport type { APIMessageComponentEmoji, APISelectMenuOption } from 'discord-api-types/v10';\nimport {\n\tdefaultValidator,\n\temojiValidator,\n\tlabelValueDescriptionValidator,\n\tvalidateRequiredSelectMenuOptionParameters,\n} from '../Assertions.js';\n\n/**\n * A builder that creates API-compatible JSON data for string select menu options.\n */\nexport class StringSelectMenuOptionBuilder implements JSONEncodable {\n\t/**\n\t * Creates a new string select menu option from API data.\n\t *\n\t * @param data - The API data to create this string select menu option with\n\t * @example\n\t * Creating a string select menu option from an API data object:\n\t * ```ts\n\t * const selectMenuOption = new SelectMenuOptionBuilder({\n\t * \tlabel: 'catchy label',\n\t * \tvalue: '1',\n\t * });\n\t * ```\n\t * @example\n\t * Creating a string select menu option using setters and API data:\n\t * ```ts\n\t * const selectMenuOption = new SelectMenuOptionBuilder({\n\t * \tdefault: true,\n\t * \tvalue: '1',\n\t * })\n\t * \t.setLabel('woah');\n\t * ```\n\t */\n\tpublic constructor(public data: Partial = {}) {}\n\n\t/**\n\t * Sets the label for this option.\n\t *\n\t * @param label - The label to use\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValueDescriptionValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value for this option.\n\t *\n\t * @param value - The value to use\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = labelValueDescriptionValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description for this option.\n\t *\n\t * @param description - The description to use\n\t */\n\tpublic setDescription(description: string) {\n\t\tthis.data.description = labelValueDescriptionValidator.parse(description);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this option is selected by default.\n\t *\n\t * @param isDefault - Whether this option is selected by default\n\t */\n\tpublic setDefault(isDefault = true) {\n\t\tthis.data.default = defaultValidator.parse(isDefault);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display for this option.\n\t *\n\t * @param emoji - The emoji to use\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc BaseSelectMenuBuilder.toJSON}\n\t */\n\tpublic toJSON(): APISelectMenuOption {\n\t\tvalidateRequiredSelectMenuOptionParameters(this.data.label, this.data.value);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APISelectMenuOption;\n\t}\n}\n","/* eslint-disable jsdoc/check-param-names */\n\nimport {\n\ttype APIActionRowComponent,\n\tComponentType,\n\ttype APIMessageActionRowComponent,\n\ttype APIModalActionRowComponent,\n\ttype APIActionRowComponentTypes,\n} from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../util/normalizeArray.js';\nimport { ComponentBuilder } from './Component.js';\nimport { createComponentBuilder } from './Components.js';\nimport type { ButtonBuilder } from './button/Button.js';\nimport type { ChannelSelectMenuBuilder } from './selectMenu/ChannelSelectMenu.js';\nimport type { MentionableSelectMenuBuilder } from './selectMenu/MentionableSelectMenu.js';\nimport type { RoleSelectMenuBuilder } from './selectMenu/RoleSelectMenu.js';\nimport type { StringSelectMenuBuilder } from './selectMenu/StringSelectMenu.js';\nimport type { UserSelectMenuBuilder } from './selectMenu/UserSelectMenu.js';\nimport type { TextInputBuilder } from './textInput/TextInput.js';\n\n/**\n * The builders that may be used for messages.\n */\nexport type MessageComponentBuilder =\n\t| ActionRowBuilder\n\t| MessageActionRowComponentBuilder;\n\n/**\n * The builders that may be used for modals.\n */\nexport type ModalComponentBuilder = ActionRowBuilder | ModalActionRowComponentBuilder;\n\n/**\n * The builders that may be used within an action row for messages.\n */\nexport type MessageActionRowComponentBuilder =\n\t| ButtonBuilder\n\t| ChannelSelectMenuBuilder\n\t| MentionableSelectMenuBuilder\n\t| RoleSelectMenuBuilder\n\t| StringSelectMenuBuilder\n\t| UserSelectMenuBuilder;\n\n/**\n * The builders that may be used within an action row for modals.\n */\nexport type ModalActionRowComponentBuilder = TextInputBuilder;\n\n/**\n * Any builder.\n */\nexport type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;\n\n/**\n * A builder that creates API-compatible JSON data for action rows.\n *\n * @typeParam ComponentType - The types of components this action row holds\n */\nexport class ActionRowBuilder extends ComponentBuilder<\n\tAPIActionRowComponent\n> {\n\t/**\n\t * The components within this action row.\n\t */\n\tpublic readonly components: ComponentType[];\n\n\t/**\n\t * Creates a new action row from API data.\n\t *\n\t * @param data - The API data to create this action row with\n\t * @example\n\t * Creating an action row from an API data object:\n\t * ```ts\n\t * const actionRow = new ActionRowBuilder({\n\t * \tcomponents: [\n\t * \t\t{\n\t * \t\t\tcustom_id: \"custom id\",\n\t * \t\t\tlabel: \"Type something\",\n\t * \t\t\tstyle: TextInputStyle.Short,\n\t * \t\t\ttype: ComponentType.TextInput,\n\t * \t\t},\n\t * \t],\n\t * });\n\t * ```\n\t * @example\n\t * Creating an action row using setters and API data:\n\t * ```ts\n\t * const actionRow = new ActionRowBuilder({\n\t * \tcomponents: [\n\t * \t\t{\n\t * \t\t\tcustom_id: \"custom id\",\n\t * \t\t\tlabel: \"Click me\",\n\t * \t\t\tstyle: ButtonStyle.Primary,\n\t * \t\t\ttype: ComponentType.Button,\n\t * \t\t},\n\t * \t],\n\t * })\n\t * \t.addComponents(button2, button3);\n\t * ```\n\t */\n\tpublic constructor({ components, ...data }: Partial> = {}) {\n\t\tsuper({ type: ComponentType.ActionRow, ...data });\n\t\tthis.components = (components?.map((component) => createComponentBuilder(component)) ?? []) as ComponentType[];\n\t}\n\n\t/**\n\t * Adds components to this action row.\n\t *\n\t * @param components - The components to add\n\t */\n\tpublic addComponents(...components: RestOrArray) {\n\t\tthis.components.push(...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets components for this action row.\n\t *\n\t * @param components - The components to set\n\t */\n\tpublic setComponents(...components: RestOrArray) {\n\t\tthis.components.splice(0, this.components.length, ...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APIActionRowComponent> {\n\t\treturn {\n\t\t\t...this.data,\n\t\t\tcomponents: this.components.map((component) => component.toJSON()),\n\t\t} as APIActionRowComponent>;\n\t}\n}\n","import type { JSONEncodable } from '@discordjs/util';\nimport type {\n\tAPIActionRowComponent,\n\tAPIActionRowComponentTypes,\n\tAPIBaseComponent,\n\tComponentType,\n} from 'discord-api-types/v10';\n\n/**\n * Any action row component data represented as an object.\n */\nexport type AnyAPIActionRowComponent = APIActionRowComponent | APIActionRowComponentTypes;\n\n/**\n * The base component builder that contains common symbols for all sorts of components.\n *\n * @typeParam DataType - The type of internal API data that is stored within the component\n */\nexport abstract class ComponentBuilder<\n\tDataType extends Partial> = APIBaseComponent,\n> implements JSONEncodable\n{\n\t/**\n\t * The API data associated with this component.\n\t */\n\tpublic readonly data: Partial;\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic abstract toJSON(): AnyAPIActionRowComponent;\n\n\t/**\n\t * Constructs a new kind of component.\n\t *\n\t * @param data - The data to construct a component out of\n\t */\n\tpublic constructor(data: Partial) {\n\t\tthis.data = data;\n\t}\n}\n","import { ComponentType, type APIMessageComponent, type APIModalComponent } from 'discord-api-types/v10';\nimport {\n\tActionRowBuilder,\n\ttype AnyComponentBuilder,\n\ttype MessageComponentBuilder,\n\ttype ModalComponentBuilder,\n} from './ActionRow.js';\nimport { ComponentBuilder } from './Component.js';\nimport { ButtonBuilder } from './button/Button.js';\nimport { ChannelSelectMenuBuilder } from './selectMenu/ChannelSelectMenu.js';\nimport { MentionableSelectMenuBuilder } from './selectMenu/MentionableSelectMenu.js';\nimport { RoleSelectMenuBuilder } from './selectMenu/RoleSelectMenu.js';\nimport { StringSelectMenuBuilder } from './selectMenu/StringSelectMenu.js';\nimport { UserSelectMenuBuilder } from './selectMenu/UserSelectMenu.js';\nimport { TextInputBuilder } from './textInput/TextInput.js';\n\n/**\n * Components here are mapped to their respective builder.\n */\nexport interface MappedComponentTypes {\n\t/**\n\t * The action row component type is associated with an {@link ActionRowBuilder}.\n\t */\n\t[ComponentType.ActionRow]: ActionRowBuilder;\n\t/**\n\t * The button component type is associated with an {@link ButtonBuilder}.\n\t */\n\t[ComponentType.Button]: ButtonBuilder;\n\t/**\n\t * The string select component type is associated with an {@link StringSelectMenuBuilder}.\n\t */\n\t[ComponentType.StringSelect]: StringSelectMenuBuilder;\n\t/**\n\t * The text inpiut component type is associated with an {@link TextInputBuilder}.\n\t */\n\t[ComponentType.TextInput]: TextInputBuilder;\n\t/**\n\t * The user select component type is associated with an {@link UserSelectMenuBuilder}.\n\t */\n\t[ComponentType.UserSelect]: UserSelectMenuBuilder;\n\t/**\n\t * The role select component type is associated with an {@link RoleSelectMenuBuilder}.\n\t */\n\t[ComponentType.RoleSelect]: RoleSelectMenuBuilder;\n\t/**\n\t * The mentionable select component type is associated with an {@link MentionableSelectMenuBuilder}.\n\t */\n\t[ComponentType.MentionableSelect]: MentionableSelectMenuBuilder;\n\t/**\n\t * The channel select component type is associated with an {@link ChannelSelectMenuBuilder}.\n\t */\n\t[ComponentType.ChannelSelect]: ChannelSelectMenuBuilder;\n}\n\n/**\n * Factory for creating components from API data.\n *\n * @typeParam ComponentType - The type of component to use\n * @param data - The API data to transform to a component class\n */\nexport function createComponentBuilder(\n\t// eslint-disable-next-line @typescript-eslint/sort-type-constituents\n\tdata: (APIModalComponent | APIMessageComponent) & { type: ComponentType },\n): MappedComponentTypes[ComponentType];\n\n/**\n * Factory for creating components from API data.\n *\n * @typeParam ComponentBuilder - The type of component to use\n * @param data - The API data to transform to a component class\n */\nexport function createComponentBuilder(\n\tdata: ComponentBuilder,\n): ComponentBuilder;\n\nexport function createComponentBuilder(\n\tdata: APIMessageComponent | APIModalComponent | MessageComponentBuilder,\n): ComponentBuilder {\n\tif (data instanceof ComponentBuilder) {\n\t\treturn data;\n\t}\n\n\tswitch (data.type) {\n\t\tcase ComponentType.ActionRow:\n\t\t\treturn new ActionRowBuilder(data);\n\t\tcase ComponentType.Button:\n\t\t\treturn new ButtonBuilder(data);\n\t\tcase ComponentType.StringSelect:\n\t\t\treturn new StringSelectMenuBuilder(data);\n\t\tcase ComponentType.TextInput:\n\t\t\treturn new TextInputBuilder(data);\n\t\tcase ComponentType.UserSelect:\n\t\t\treturn new UserSelectMenuBuilder(data);\n\t\tcase ComponentType.RoleSelect:\n\t\t\treturn new RoleSelectMenuBuilder(data);\n\t\tcase ComponentType.MentionableSelect:\n\t\t\treturn new MentionableSelectMenuBuilder(data);\n\t\tcase ComponentType.ChannelSelect:\n\t\t\treturn new ChannelSelectMenuBuilder(data);\n\t\tdefault:\n\t\t\t// @ts-expect-error This case can still occur if we get a newer unsupported component type\n\t\t\tthrow new Error(`Cannot properly serialize component type: ${data.type}`);\n\t}\n}\n","import {\n\tComponentType,\n\ttype APIMessageComponentEmoji,\n\ttype APIButtonComponent,\n\ttype APIButtonComponentWithURL,\n\ttype APIButtonComponentWithCustomId,\n\ttype ButtonStyle,\n} from 'discord-api-types/v10';\nimport {\n\tbuttonLabelValidator,\n\tbuttonStyleValidator,\n\tcustomIdValidator,\n\tdisabledValidator,\n\temojiValidator,\n\turlValidator,\n\tvalidateRequiredButtonParameters,\n} from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\n\n/**\n * A builder that creates API-compatible JSON data for buttons.\n */\nexport class ButtonBuilder extends ComponentBuilder {\n\t/**\n\t * Creates a new button from API data.\n\t *\n\t * @param data - The API data to create this button with\n\t * @example\n\t * Creating a button from an API data object:\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tcustom_id: 'a cool button',\n\t * \tstyle: ButtonStyle.Primary,\n\t * \tlabel: 'Click Me',\n\t * \temoji: {\n\t * \t\tname: 'smile',\n\t * \t\tid: '123456789012345678',\n\t * \t},\n\t * });\n\t * ```\n\t * @example\n\t * Creating a button using setters and API data:\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: ButtonStyle.Secondary,\n\t * \tlabel: 'Click Me',\n\t * })\n\t * \t.setEmoji({ name: '🙂' })\n\t * \t.setCustomId('another cool button');\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ type: ComponentType.Button, ...data });\n\t}\n\n\t/**\n\t * Sets the style of this button.\n\t *\n\t * @param style - The style to use\n\t */\n\tpublic setStyle(style: ButtonStyle) {\n\t\tthis.data.style = buttonStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL for this button.\n\t *\n\t * @remarks\n\t * This method is only available to buttons using the `Link` button style.\n\t * Only three types of URL schemes are currently supported: `https://`, `http://`, and `discord://`.\n\t * @param url - The URL to use\n\t */\n\tpublic setURL(url: string) {\n\t\t(this.data as APIButtonComponentWithURL).url = urlValidator.parse(url);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this button.\n\t *\n\t * @remarks\n\t * This method is only applicable to buttons that are not using the `Link` button style.\n\t * @param customId - The custom id to use\n\t */\n\tpublic setCustomId(customId: string) {\n\t\t(this.data as APIButtonComponentWithCustomId).custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this button.\n\t *\n\t * @param emoji - The emoji to use\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this button is disabled.\n\t *\n\t * @param disabled - Whether to disable this button\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this button.\n\t *\n\t * @param label - The label to use\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = buttonLabelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APIButtonComponent {\n\t\tvalidateRequiredButtonParameters(\n\t\t\tthis.data.style,\n\t\t\tthis.data.label,\n\t\t\tthis.data.emoji,\n\t\t\t(this.data as APIButtonComponentWithCustomId).custom_id,\n\t\t\t(this.data as APIButtonComponentWithURL).url,\n\t\t);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APIButtonComponent;\n\t}\n}\n","import {\n\ttype APIChannelSelectComponent,\n\ttype ChannelType,\n\ttype Snowflake,\n\tComponentType,\n\tSelectMenuDefaultValueType,\n} from 'discord-api-types/v10';\nimport { type RestOrArray, normalizeArray } from '../../util/normalizeArray.js';\nimport { channelTypesValidator, customIdValidator, optionsLengthValidator } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\n\n/**\n * A builder that creates API-compatible JSON data for channel select menus.\n */\nexport class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new ChannelSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new ChannelSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)\n\t * \t.setMinValues(2);\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ ...data, type: ComponentType.ChannelSelect });\n\t}\n\n\t/**\n\t * Adds channel types to this select menu.\n\t *\n\t * @param types - The channel types to use\n\t */\n\tpublic addChannelTypes(...types: RestOrArray) {\n\t\tconst normalizedTypes = normalizeArray(types);\n\t\tthis.data.channel_types ??= [];\n\t\tthis.data.channel_types.push(...channelTypesValidator.parse(normalizedTypes));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets channel types for this select menu.\n\t *\n\t * @param types - The channel types to use\n\t */\n\tpublic setChannelTypes(...types: RestOrArray) {\n\t\tconst normalizedTypes = normalizeArray(types);\n\t\tthis.data.channel_types ??= [];\n\t\tthis.data.channel_types.splice(0, this.data.channel_types.length, ...channelTypesValidator.parse(normalizedTypes));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds default channels to this auto populated select menu.\n\t *\n\t * @param channels - The channels to add\n\t */\n\tpublic addDefaultChannels(...channels: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(channels);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.Channel as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets default channels to this auto populated select menu.\n\t *\n\t * @param channels - The channels to set\n\t */\n\tpublic setDefaultChannels(...channels: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(channels);\n\t\toptionsLengthValidator.parse(normalizedValues.length);\n\n\t\tthis.data.default_values = normalizedValues.map((id) => ({\n\t\t\tid,\n\t\t\ttype: SelectMenuDefaultValueType.Channel as const,\n\t\t}));\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc BaseSelectMenuBuilder.toJSON}\n\t */\n\tpublic override toJSON(): APIChannelSelectComponent {\n\t\tcustomIdValidator.parse(this.data.custom_id);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APIChannelSelectComponent;\n\t}\n}\n","import type { APISelectMenuComponent } from 'discord-api-types/v10';\nimport { customIdValidator, disabledValidator, minMaxValidator, placeholderValidator } from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\n\n/**\n * The base select menu builder that contains common symbols for select menu builders.\n *\n * @typeParam SelectMenuType - The type of select menu this would be instantiated for.\n */\nexport abstract class BaseSelectMenuBuilder<\n\tSelectMenuType extends APISelectMenuComponent,\n> extends ComponentBuilder {\n\t/**\n\t * Sets the placeholder for this select menu.\n\t *\n\t * @param placeholder - The placeholder to use\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum values that must be selected in the select menu.\n\t *\n\t * @param minValues - The minimum values that must be selected\n\t */\n\tpublic setMinValues(minValues: number) {\n\t\tthis.data.min_values = minMaxValidator.parse(minValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum values that must be selected in the select menu.\n\t *\n\t * @param maxValues - The maximum values that must be selected\n\t */\n\tpublic setMaxValues(maxValues: number) {\n\t\tthis.data.max_values = minMaxValidator.parse(maxValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this select menu.\n\t *\n\t * @param customId - The custom id to use\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this select menu is disabled.\n\t *\n\t * @param disabled - Whether this select menu is disabled\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): SelectMenuType {\n\t\tcustomIdValidator.parse(this.data.custom_id);\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as SelectMenuType;\n\t}\n}\n","import {\n\ttype APIMentionableSelectComponent,\n\ttype APISelectMenuDefaultValue,\n\ttype Snowflake,\n\tComponentType,\n\tSelectMenuDefaultValueType,\n} from 'discord-api-types/v10';\nimport { type RestOrArray, normalizeArray } from '../../util/normalizeArray.js';\nimport { optionsLengthValidator } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\n\n/**\n * A builder that creates API-compatible JSON data for mentionable select menus.\n */\nexport class MentionableSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new MentionableSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new MentionableSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.setMinValues(1);\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ ...data, type: ComponentType.MentionableSelect });\n\t}\n\n\t/**\n\t * Adds default roles to this auto populated select menu.\n\t *\n\t * @param roles - The roles to add\n\t */\n\tpublic addDefaultRoles(...roles: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(roles);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.Role as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds default users to this auto populated select menu.\n\t *\n\t * @param users - The users to add\n\t */\n\tpublic addDefaultUsers(...users: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(users);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.User as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds default values to this auto populated select menu.\n\t *\n\t * @param values - The values to add\n\t */\n\tpublic addDefaultValues(\n\t\t...values: RestOrArray<\n\t\t\t| APISelectMenuDefaultValue\n\t\t\t| APISelectMenuDefaultValue\n\t\t>\n\t) {\n\t\tconst normalizedValues = normalizeArray(values);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\t\tthis.data.default_values.push(...normalizedValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets default values to this auto populated select menu.\n\t *\n\t * @param values - The values to set\n\t */\n\tpublic setDefaultValues(\n\t\t...values: RestOrArray<\n\t\t\t| APISelectMenuDefaultValue\n\t\t\t| APISelectMenuDefaultValue\n\t\t>\n\t) {\n\t\tconst normalizedValues = normalizeArray(values);\n\t\toptionsLengthValidator.parse(normalizedValues.length);\n\t\tthis.data.default_values = normalizedValues.slice();\n\t\treturn this;\n\t}\n}\n","import {\n\ttype APIRoleSelectComponent,\n\ttype Snowflake,\n\tComponentType,\n\tSelectMenuDefaultValueType,\n} from 'discord-api-types/v10';\nimport { type RestOrArray, normalizeArray } from '../../util/normalizeArray.js';\nimport { optionsLengthValidator } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\n\n/**\n * A builder that creates API-compatible JSON data for role select menus.\n */\nexport class RoleSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new RoleSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new RoleSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.setMinValues(1);\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ ...data, type: ComponentType.RoleSelect });\n\t}\n\n\t/**\n\t * Adds default roles to this auto populated select menu.\n\t *\n\t * @param roles - The roles to add\n\t */\n\tpublic addDefaultRoles(...roles: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(roles);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.Role as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets default roles to this auto populated select menu.\n\t *\n\t * @param roles - The roles to set\n\t */\n\tpublic setDefaultRoles(...roles: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(roles);\n\t\toptionsLengthValidator.parse(normalizedValues.length);\n\n\t\tthis.data.default_values = normalizedValues.map((id) => ({\n\t\t\tid,\n\t\t\ttype: SelectMenuDefaultValueType.Role as const,\n\t\t}));\n\n\t\treturn this;\n\t}\n}\n","import { ComponentType } from 'discord-api-types/v10';\nimport type { APIStringSelectComponent, APISelectMenuOption } from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray.js';\nimport { jsonOptionValidator, optionsLengthValidator, validateRequiredSelectMenuParameters } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\nimport { StringSelectMenuOptionBuilder } from './StringSelectMenuOption.js';\n\n/**\n * A builder that creates API-compatible JSON data for string select menus.\n */\nexport class StringSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * The options within this select menu.\n\t */\n\tpublic readonly options: StringSelectMenuOptionBuilder[];\n\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new StringSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * \toptions: [\n\t * \t\t{ label: 'option 1', value: '1' },\n\t * \t\t{ label: 'option 2', value: '2' },\n\t * \t\t{ label: 'option 3', value: '3' },\n\t * \t],\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new StringSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.setMinValues(1)\n\t * \t.addOptions({\n\t * \t\tlabel: 'Catchy',\n\t * \t\tvalue: 'catch',\n\t * \t});\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tconst { options, ...initData } = data ?? {};\n\t\tsuper({ ...initData, type: ComponentType.StringSelect });\n\t\tthis.options = options?.map((option: APISelectMenuOption) => new StringSelectMenuOptionBuilder(option)) ?? [];\n\t}\n\n\t/**\n\t * Adds options to this select menu.\n\t *\n\t * @param options - The options to add\n\t */\n\tpublic addOptions(...options: RestOrArray) {\n\t\tconst normalizedOptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(this.options.length + normalizedOptions.length);\n\t\tthis.options.push(\n\t\t\t...normalizedOptions.map((normalizedOption) =>\n\t\t\t\tnormalizedOption instanceof StringSelectMenuOptionBuilder\n\t\t\t\t\t? normalizedOption\n\t\t\t\t\t: new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the options for this select menu.\n\t *\n\t * @param options - The options to set\n\t */\n\tpublic setOptions(...options: RestOrArray) {\n\t\treturn this.spliceOptions(0, this.options.length, ...options);\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts options for this select menu.\n\t *\n\t * @remarks\n\t * This method behaves similarly\n\t * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice()}.\n\t * It's useful for modifying and adjusting the order of existing options.\n\t * @example\n\t * Remove the first option:\n\t * ```ts\n\t * selectMenu.spliceOptions(0, 1);\n\t * ```\n\t * @example\n\t * Remove the first n option:\n\t * ```ts\n\t * const n = 4;\n\t * selectMenu.spliceOptions(0, n);\n\t * ```\n\t * @example\n\t * Remove the last option:\n\t * ```ts\n\t * selectMenu.spliceOptions(-1, 1);\n\t * ```\n\t * @param index - The index to start at\n\t * @param deleteCount - The number of options to remove\n\t * @param options - The replacing option objects or builders\n\t */\n\tpublic spliceOptions(\n\t\tindex: number,\n\t\tdeleteCount: number,\n\t\t...options: RestOrArray\n\t) {\n\t\tconst normalizedOptions = normalizeArray(options);\n\n\t\tconst clone = [...this.options];\n\n\t\tclone.splice(\n\t\t\tindex,\n\t\t\tdeleteCount,\n\t\t\t...normalizedOptions.map((normalizedOption) =>\n\t\t\t\tnormalizedOption instanceof StringSelectMenuOptionBuilder\n\t\t\t\t\t? normalizedOption\n\t\t\t\t\t: new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption)),\n\t\t\t),\n\t\t);\n\n\t\toptionsLengthValidator.parse(clone.length);\n\t\tthis.options.splice(0, this.options.length, ...clone);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc BaseSelectMenuBuilder.toJSON}\n\t */\n\tpublic override toJSON(): APIStringSelectComponent {\n\t\tvalidateRequiredSelectMenuParameters(this.options, this.data.custom_id);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t} as APIStringSelectComponent;\n\t}\n}\n","import {\n\ttype APIUserSelectComponent,\n\ttype Snowflake,\n\tComponentType,\n\tSelectMenuDefaultValueType,\n} from 'discord-api-types/v10';\nimport { type RestOrArray, normalizeArray } from '../../util/normalizeArray.js';\nimport { optionsLengthValidator } from '../Assertions.js';\nimport { BaseSelectMenuBuilder } from './BaseSelectMenu.js';\n\n/**\n * A builder that creates API-compatible JSON data for user select menus.\n */\nexport class UserSelectMenuBuilder extends BaseSelectMenuBuilder {\n\t/**\n\t * Creates a new select menu from API data.\n\t *\n\t * @param data - The API data to create this select menu with\n\t * @example\n\t * Creating a select menu from an API data object:\n\t * ```ts\n\t * const selectMenu = new UserSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tplaceholder: 'select an option',\n\t * \tmax_values: 2,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu using setters and API data:\n\t * ```ts\n\t * const selectMenu = new UserSelectMenuBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * })\n\t * \t.setMinValues(1);\n\t * ```\n\t */\n\tpublic constructor(data?: Partial) {\n\t\tsuper({ ...data, type: ComponentType.UserSelect });\n\t}\n\n\t/**\n\t * Adds default users to this auto populated select menu.\n\t *\n\t * @param users - The users to add\n\t */\n\tpublic addDefaultUsers(...users: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(users);\n\t\toptionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);\n\t\tthis.data.default_values ??= [];\n\n\t\tthis.data.default_values.push(\n\t\t\t...normalizedValues.map((id) => ({\n\t\t\t\tid,\n\t\t\t\ttype: SelectMenuDefaultValueType.User as const,\n\t\t\t})),\n\t\t);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets default users to this auto populated select menu.\n\t *\n\t * @param users - The users to set\n\t */\n\tpublic setDefaultUsers(...users: RestOrArray) {\n\t\tconst normalizedValues = normalizeArray(users);\n\t\toptionsLengthValidator.parse(normalizedValues.length);\n\n\t\tthis.data.default_values = normalizedValues.map((id) => ({\n\t\t\tid,\n\t\t\ttype: SelectMenuDefaultValueType.User as const,\n\t\t}));\n\n\t\treturn this;\n\t}\n}\n","import { isJSONEncodable, type Equatable, type JSONEncodable } from '@discordjs/util';\nimport { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';\nimport isEqual from 'fast-deep-equal';\nimport { customIdValidator } from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\nimport {\n\tmaxLengthValidator,\n\tminLengthValidator,\n\tplaceholderValidator,\n\trequiredValidator,\n\tvalueValidator,\n\tvalidateRequiredParameters,\n\tlabelValidator,\n\ttextInputStyleValidator,\n} from './Assertions.js';\n\n/**\n * A builder that creates API-compatible JSON data for text inputs.\n */\nexport class TextInputBuilder\n\textends ComponentBuilder\n\timplements Equatable>\n{\n\t/**\n\t * Creates a new text input from API data.\n\t *\n\t * @param data - The API data to create this text input with\n\t * @example\n\t * Creating a select menu option from an API data object:\n\t * ```ts\n\t * const textInput = new TextInputBuilder({\n\t * \tcustom_id: 'a cool select menu',\n\t * \tlabel: 'Type something',\n\t * \tstyle: TextInputStyle.Short,\n\t * });\n\t * ```\n\t * @example\n\t * Creating a select menu option using setters and API data:\n\t * ```ts\n\t * const textInput = new TextInputBuilder({\n\t * \tlabel: 'Type something else',\n\t * })\n\t * \t.setCustomId('woah')\n\t * \t.setStyle(TextInputStyle.Paragraph);\n\t * ```\n\t */\n\tpublic constructor(data?: APITextInputComponent & { type?: ComponentType.TextInput }) {\n\t\tsuper({ type: ComponentType.TextInput, ...data });\n\t}\n\n\t/**\n\t * Sets the custom id for this text input.\n\t *\n\t * @param customId - The custom id to use\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this text input.\n\t *\n\t * @param label - The label to use\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the style for this text input.\n\t *\n\t * @param style - The style to use\n\t */\n\tpublic setStyle(style: TextInputStyle) {\n\t\tthis.data.style = textInputStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum length of text for this text input.\n\t *\n\t * @param minLength - The minimum length of text for this text input\n\t */\n\tpublic setMinLength(minLength: number) {\n\t\tthis.data.min_length = minLengthValidator.parse(minLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum length of text for this text input.\n\t *\n\t * @param maxLength - The maximum length of text for this text input\n\t */\n\tpublic setMaxLength(maxLength: number) {\n\t\tthis.data.max_length = maxLengthValidator.parse(maxLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the placeholder for this text input.\n\t *\n\t * @param placeholder - The placeholder to use\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value for this text input.\n\t *\n\t * @param value - The value to use\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = valueValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this text input is required.\n\t *\n\t * @param required - Whether this text input is required\n\t */\n\tpublic setRequired(required = true) {\n\t\tthis.data.required = requiredValidator.parse(required);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APITextInputComponent {\n\t\tvalidateRequiredParameters(this.data.custom_id, this.data.style, this.data.label);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APITextInputComponent;\n\t}\n\n\t/**\n\t * {@inheritDoc Equatable.equals}\n\t */\n\tpublic equals(other: APITextInputComponent | JSONEncodable): boolean {\n\t\tif (isJSONEncodable(other)) {\n\t\t\treturn isEqual(other.toJSON(), this.data);\n\t\t}\n\n\t\treturn isEqual(other, this.data);\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { TextInputStyle } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../../util/validation.js';\nimport { customIdValidator } from '../Assertions.js';\n\nexport const textInputStyleValidator = s.nativeEnum(TextInputStyle);\nexport const minLengthValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(4_000)\n\t.setValidationEnabled(isValidationEnabled);\nexport const maxLengthValidator = s.number.int\n\t.greaterThanOrEqual(1)\n\t.lessThanOrEqual(4_000)\n\t.setValidationEnabled(isValidationEnabled);\nexport const requiredValidator = s.boolean;\nexport const valueValidator = s.string.lengthLessThanOrEqual(4_000).setValidationEnabled(isValidationEnabled);\nexport const placeholderValidator = s.string.lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);\nexport const labelValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(45)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredParameters(customId?: string, style?: TextInputStyle, label?: string) {\n\tcustomIdValidator.parse(customId);\n\ttextInputStyleValidator.parse(style);\n\tlabelValidator.parse(label);\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ActionRowBuilder, type ModalActionRowComponentBuilder } from '../../components/ActionRow.js';\nimport { customIdValidator } from '../../components/Assertions.js';\nimport { isValidationEnabled } from '../../util/validation.js';\n\nexport const titleValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(45)\n\t.setValidationEnabled(isValidationEnabled);\nexport const componentsValidator = s\n\t.instance(ActionRowBuilder)\n\t.array.lengthGreaterThanOrEqual(1)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredParameters(\n\tcustomId?: string,\n\ttitle?: string,\n\tcomponents?: ActionRowBuilder[],\n) {\n\tcustomIdValidator.parse(customId);\n\ttitleValidator.parse(title);\n\tcomponentsValidator.parse(components);\n}\n","/* eslint-disable jsdoc/check-param-names */\n\nimport type { JSONEncodable } from '@discordjs/util';\nimport type {\n\tAPIActionRowComponent,\n\tAPIModalActionRowComponent,\n\tAPIModalInteractionResponseCallbackData,\n} from 'discord-api-types/v10';\nimport { ActionRowBuilder, type ModalActionRowComponentBuilder } from '../../components/ActionRow.js';\nimport { customIdValidator } from '../../components/Assertions.js';\nimport { createComponentBuilder } from '../../components/Components.js';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray.js';\nimport { titleValidator, validateRequiredParameters } from './Assertions.js';\n\n/**\n * A builder that creates API-compatible JSON data for modals.\n */\nexport class ModalBuilder implements JSONEncodable {\n\t/**\n\t * The API data associated with this modal.\n\t */\n\tpublic readonly data: Partial;\n\n\t/**\n\t * The components within this modal.\n\t */\n\tpublic readonly components: ActionRowBuilder[] = [];\n\n\t/**\n\t * Creates a new modal from API data.\n\t *\n\t * @param data - The API data to create this modal with\n\t */\n\tpublic constructor({ components, ...data }: Partial = {}) {\n\t\tthis.data = { ...data };\n\t\tthis.components = (components?.map((component) => createComponentBuilder(component)) ??\n\t\t\t[]) as ActionRowBuilder[];\n\t}\n\n\t/**\n\t * Sets the title of this modal.\n\t *\n\t * @param title - The title to use\n\t */\n\tpublic setTitle(title: string) {\n\t\tthis.data.title = titleValidator.parse(title);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id of this modal.\n\t *\n\t * @param customId - The custom id to use\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds components to this modal.\n\t *\n\t * @param components - The components to add\n\t */\n\tpublic addComponents(\n\t\t...components: RestOrArray<\n\t\t\tActionRowBuilder | APIActionRowComponent\n\t\t>\n\t) {\n\t\tthis.components.push(\n\t\t\t...normalizeArray(components).map((component) =>\n\t\t\t\tcomponent instanceof ActionRowBuilder\n\t\t\t\t\t? component\n\t\t\t\t\t: new ActionRowBuilder(component),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets components for this modal.\n\t *\n\t * @param components - The components to set\n\t */\n\tpublic setComponents(...components: RestOrArray>) {\n\t\tthis.components.splice(0, this.components.length, ...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APIModalInteractionResponseCallbackData {\n\t\tvalidateRequiredParameters(this.data.custom_id, this.data.title, this.components);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t\tcomponents: this.components.map((component) => component.toJSON()),\n\t\t} as APIModalInteractionResponseCallbackData;\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { Locale, type APIApplicationCommandOptionChoice, type LocalizationMap } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../../util/validation.js';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder.js';\nimport type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands.js';\nimport type { ApplicationCommandOptionBase } from './mixins/ApplicationCommandOptionBase.js';\n\nconst namePredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(32)\n\t.regex(/^[\\p{Ll}\\p{Lm}\\p{Lo}\\p{N}\\p{sc=Devanagari}\\p{sc=Thai}_-]+$/u)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateName(name: unknown): asserts name is string {\n\tnamePredicate.parse(name);\n}\n\nconst descriptionPredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\nconst localePredicate = s.nativeEnum(Locale);\n\nexport function validateDescription(description: unknown): asserts description is string {\n\tdescriptionPredicate.parse(description);\n}\n\nconst maxArrayLengthPredicate = s.unknown.array.lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);\nexport function validateLocale(locale: unknown) {\n\treturn localePredicate.parse(locale);\n}\n\nexport function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[] {\n\tmaxArrayLengthPredicate.parse(options);\n}\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 booleanPredicate = s.boolean;\n\nexport function validateDefaultPermission(value: unknown): asserts value is boolean {\n\tbooleanPredicate.parse(value);\n}\n\nexport function validateRequired(required: unknown): asserts required is boolean {\n\tbooleanPredicate.parse(required);\n}\n\nconst choicesLengthPredicate = s.number.lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);\n\nexport function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void {\n\tchoicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);\n}\n\nexport function assertReturnOfBuilder<\n\tReturnType extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder,\n>(input: unknown, ExpectedInstanceOf: new () => ReturnType): asserts input is ReturnType {\n\ts.instance(ExpectedInstanceOf).parse(input);\n}\n\nexport const localizationMapPredicate = s\n\t.object(Object.fromEntries(Object.values(Locale).map((locale) => [locale, s.string.nullish])))\n\t.strict.nullish.setValidationEnabled(isValidationEnabled);\n\nexport function validateLocalizationMap(value: unknown): asserts value is LocalizationMap {\n\tlocalizationMapPredicate.parse(value);\n}\n\nconst dmPermissionPredicate = s.boolean.nullish;\n\nexport function validateDMPermission(value: unknown): asserts value is boolean | null | undefined {\n\tdmPermissionPredicate.parse(value);\n}\n\nconst memberPermissionPredicate = s.union(\n\ts.bigint.transform((value) => value.toString()),\n\ts.number.safeInt.transform((value) => value.toString()),\n\ts.string.regex(/^\\d+$/),\n).nullish;\n\nexport function validateDefaultMemberPermissions(permissions: unknown) {\n\treturn memberPermissionPredicate.parse(permissions);\n}\n\nexport function validateNSFW(value: unknown): asserts value is boolean {\n\tbooleanPredicate.parse(value);\n}\n","import type {\n\tAPIApplicationCommandOption,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIChatInputApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport {\n\tassertReturnOfBuilder,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDefaultPermission,\n\tvalidateLocalizationMap,\n\tvalidateDMPermission,\n\tvalidateMaxOptionsLength,\n\tvalidateRequiredParameters,\n\tvalidateNSFW,\n} from './Assertions.js';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands.js';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription.js';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions.js';\n\n/**\n * A builder that creates API-compatible JSON data for slash commands.\n */\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this command.\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The name localizations of this command.\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this command.\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The description localizations of this command.\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * The options of this command.\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Whether this command is enabled by default when the application is added to a guild.\n\t *\n\t * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead.\n\t */\n\tpublic readonly default_permission: boolean | undefined = undefined;\n\n\t/**\n\t * The set of permissions represented as a bit set for the command.\n\t */\n\tpublic readonly default_member_permissions: Permissions | null | undefined = undefined;\n\n\t/**\n\t * Indicates whether the command is available in direct messages with the application.\n\t *\n\t * @remarks\n\t * By default, commands are visible. This property is only for global commands.\n\t */\n\tpublic readonly dm_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Whether this command is NSFW.\n\t */\n\tpublic readonly nsfw: boolean | undefined = undefined;\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * @remarks\n\t * If set to `false`, you will have to later `PUT` the permissions for this command.\n\t * @param value - Whether or not to enable this command by default\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t * @deprecated Use {@link SlashCommandBuilder.setDefaultMemberPermissions} or {@link SlashCommandBuilder.setDMPermission} instead.\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'default_permission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the default permissions a member should have in order to run the command.\n\t *\n\t * @remarks\n\t * You can set this to `'0'` to disable the command by default.\n\t * @param permissions - The permissions bit field to set\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t */\n\tpublic setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined) {\n\t\t// Assert the value and parse it\n\t\tconst permissionValue = validateDefaultMemberPermissions(permissions);\n\n\t\tReflect.set(this, 'default_member_permissions', permissionValue);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets if the command is available in direct messages with the application.\n\t *\n\t * @remarks\n\t * By default, commands are visible. This method is only for global commands.\n\t * @param enabled - Whether the command should be enabled in direct messages\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t */\n\tpublic setDMPermission(enabled: boolean | null | undefined) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDMPermission(enabled);\n\n\t\tReflect.set(this, 'dm_permission', enabled);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this command is NSFW.\n\t *\n\t * @param nsfw - Whether this command is NSFW\n\t */\n\tpublic setNSFW(nsfw = true) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateNSFW(nsfw);\n\t\tReflect.set(this, 'nsfw', nsfw);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand group to this command.\n\t *\n\t * @param input - A function that returns a subcommand group builder or an already built builder\n\t */\n\tpublic addSubcommandGroup(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandGroupBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandGroupBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand to this command.\n\t *\n\t * @param input - A function that returns a subcommand builder or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): RESTPostAPIChatInputApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\treturn {\n\t\t\t...this,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n}\n\nexport interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n\n/**\n * An interface specifically for slash command subcommands.\n */\nexport interface SlashCommandSubcommandsOnlyBuilder\n\textends Omit> {}\n\n/**\n * An interface specifically for slash command options.\n */\nexport interface SlashCommandOptionsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tSharedSlashCommandOptions,\n\t\tPick {}\n\n/**\n * An interface that ensures the `toJSON()` call will return something\n * that can be serialized into API-compatible data.\n */\nexport interface ToAPIApplicationCommandOptions {\n\ttoJSON(): APIApplicationCommandOption;\n}\n","import {\n\tApplicationCommandOptionType,\n\ttype APIApplicationCommandSubcommandGroupOption,\n\ttype APIApplicationCommandSubcommandOption,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { assertReturnOfBuilder, validateMaxOptionsLength, validateRequiredParameters } from './Assertions.js';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder.js';\nimport type { ApplicationCommandOptionBase } from './mixins/ApplicationCommandOptionBase.js';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription.js';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions.js';\n\n/**\n * Represents a folder for subcommands.\n *\n * @see {@link https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups}\n */\n@mix(SharedNameAndDescription)\nexport class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {\n\t/**\n\t * The name of this subcommand group.\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this subcommand group.\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The subcommands within this subcommand group.\n\t */\n\tpublic readonly options: SlashCommandSubcommandBuilder[] = [];\n\n\t/**\n\t * Adds a new subcommand to this group.\n\t *\n\t * @param input - A function that returns a subcommand builder or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t) {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): APIApplicationCommandSubcommandGroupOption {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.SubcommandGroup,\n\t\t\tname: this.name,\n\t\t\tname_localizations: this.name_localizations,\n\t\t\tdescription: this.description,\n\t\t\tdescription_localizations: this.description_localizations,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n}\n\nexport interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {}\n\n/**\n * A builder that creates API-compatible JSON data for slash command subcommands.\n *\n * @see {@link https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups}\n */\n@mix(SharedNameAndDescription, SharedSlashCommandOptions)\nexport class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {\n\t/**\n\t * The name of this subcommand.\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this subcommand.\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The options within this subcommand.\n\t */\n\tpublic readonly options: ApplicationCommandOptionBase[] = [];\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): APIApplicationCommandSubcommandOption {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.Subcommand,\n\t\t\tname: this.name,\n\t\t\tname_localizations: this.name_localizations,\n\t\t\tdescription: this.description,\n\t\t\tdescription_localizations: this.description_localizations,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n}\n\nexport interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n","import type { LocaleString, LocalizationMap } from 'discord-api-types/v10';\nimport { validateDescription, validateLocale, validateName } from '../Assertions.js';\n\n/**\n * This mixin holds name and description symbols for slash commands.\n */\nexport class SharedNameAndDescription {\n\t/**\n\t * The name of this command.\n\t */\n\tpublic readonly name!: string;\n\n\t/**\n\t * The name localizations of this command.\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this command.\n\t */\n\tpublic readonly description!: string;\n\n\t/**\n\t * The description localizations of this command.\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * Sets the name of this command.\n\t *\n\t * @param name - The name to use\n\t */\n\tpublic setName(name: string): this {\n\t\t// Assert the name matches the conditions\n\t\tvalidateName(name);\n\n\t\tReflect.set(this, 'name', name);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this command.\n\t *\n\t * @param description - The description to use\n\t */\n\tpublic setDescription(description: string) {\n\t\t// Assert the description matches the conditions\n\t\tvalidateDescription(description);\n\n\t\tReflect.set(this, 'description', description);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a name localization for this command.\n\t *\n\t * @param locale - The locale to set\n\t * @param localizedName - The localized name for the given `locale`\n\t */\n\tpublic setNameLocalization(locale: LocaleString, localizedName: string | null) {\n\t\tif (!this.name_localizations) {\n\t\t\tReflect.set(this, 'name_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedName === null) {\n\t\t\tthis.name_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateName(localizedName);\n\n\t\tthis.name_localizations![parsedLocale] = localizedName;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the name localizations for this command.\n\t *\n\t * @param localizedNames - The object of localized names to set\n\t */\n\tpublic setNameLocalizations(localizedNames: LocalizationMap | null) {\n\t\tif (localizedNames === null) {\n\t\t\tReflect.set(this, 'name_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'name_localizations', {});\n\n\t\tfor (const args of Object.entries(localizedNames)) {\n\t\t\tthis.setNameLocalization(...(args as [LocaleString, string | null]));\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a description localization for this command.\n\t *\n\t * @param locale - The locale to set\n\t * @param localizedDescription - The localized description for the given locale\n\t */\n\tpublic setDescriptionLocalization(locale: LocaleString, localizedDescription: string | null) {\n\t\tif (!this.description_localizations) {\n\t\t\tReflect.set(this, 'description_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedDescription === null) {\n\t\t\tthis.description_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateDescription(localizedDescription);\n\n\t\tthis.description_localizations![parsedLocale] = localizedDescription;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description localizations for this command.\n\t *\n\t * @param localizedDescriptions - The object of localized descriptions to set\n\t */\n\tpublic setDescriptionLocalizations(localizedDescriptions: LocalizationMap | null) {\n\t\tif (localizedDescriptions === null) {\n\t\t\tReflect.set(this, 'description_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'description_localizations', {});\n\t\tfor (const args of Object.entries(localizedDescriptions)) {\n\t\t\tthis.setDescriptionLocalization(...(args as [LocaleString, string | null]));\n\t\t}\n\n\t\treturn this;\n\t}\n}\n","import { ApplicationCommandOptionType, type APIApplicationCommandAttachmentOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command attachment option.\n */\nexport class SlashCommandAttachmentOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic override readonly type = ApplicationCommandOptionType.Attachment as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandAttachmentOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import type { APIApplicationCommandBasicOption, ApplicationCommandOptionType } from 'discord-api-types/v10';\nimport { validateRequiredParameters, validateRequired, validateLocalizationMap } from '../Assertions.js';\nimport { SharedNameAndDescription } from './NameAndDescription.js';\n\n/**\n * The base application command option builder that contains common symbols for application command builders.\n */\nexport abstract class ApplicationCommandOptionBase extends SharedNameAndDescription {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic abstract readonly type: ApplicationCommandOptionType;\n\n\t/**\n\t * Whether this option is required.\n\t *\n\t * @defaultValue `false`\n\t */\n\tpublic readonly required: boolean = false;\n\n\t/**\n\t * Sets whether this option is required.\n\t *\n\t * @param required - Whether this option should be required\n\t */\n\tpublic setRequired(required: boolean) {\n\t\t// Assert that you actually passed a boolean\n\t\tvalidateRequired(required);\n\n\t\tReflect.set(this, 'required', required);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic abstract toJSON(): APIApplicationCommandBasicOption;\n\n\t/**\n\t * This method runs required validators on this builder.\n\t */\n\tprotected runRequiredValidations() {\n\t\tvalidateRequiredParameters(this.name, this.description, []);\n\n\t\t// Validate localizations\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\t// Assert that you actually passed a boolean\n\t\tvalidateRequired(this.required);\n\t}\n}\n","import { ApplicationCommandOptionType, type APIApplicationCommandBooleanOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command boolean option.\n */\nexport class SlashCommandBooleanOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.Boolean as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandBooleanOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import { ApplicationCommandOptionType, type APIApplicationCommandChannelOption } from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\nimport { ApplicationCommandOptionChannelTypesMixin } from '../mixins/ApplicationCommandOptionChannelTypesMixin.js';\n\n/**\n * A slash command channel option.\n */\n@mix(ApplicationCommandOptionChannelTypesMixin)\nexport class SlashCommandChannelOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic override readonly type = ApplicationCommandOptionType.Channel as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandChannelOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n\nexport interface SlashCommandChannelOption extends ApplicationCommandOptionChannelTypesMixin {}\n","import { s } from '@sapphire/shapeshift';\nimport { ChannelType } from 'discord-api-types/v10';\n\n/**\n * The allowed channel types used for a channel option in a slash command builder.\n *\n * @privateRemarks This can't be dynamic because const enums are erased at runtime.\n * @internal\n */\nconst allowedChannelTypes = [\n\tChannelType.GuildText,\n\tChannelType.GuildVoice,\n\tChannelType.GuildCategory,\n\tChannelType.GuildAnnouncement,\n\tChannelType.AnnouncementThread,\n\tChannelType.PublicThread,\n\tChannelType.PrivateThread,\n\tChannelType.GuildStageVoice,\n\tChannelType.GuildForum,\n\tChannelType.GuildMedia,\n] as const;\n\n/**\n * The type of allowed channel types used for a channel option.\n */\nexport type ApplicationCommandOptionAllowedChannelTypes = (typeof allowedChannelTypes)[number];\n\nconst channelTypesPredicate = s.array(s.union(...allowedChannelTypes.map((type) => s.literal(type))));\n\n/**\n * This mixin holds channel type symbols used for options.\n */\nexport class ApplicationCommandOptionChannelTypesMixin {\n\t/**\n\t * The channel types of this option.\n\t */\n\tpublic readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[];\n\n\t/**\n\t * Adds channel types to this option.\n\t *\n\t * @param channelTypes - The channel types\n\t */\n\tpublic addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]) {\n\t\tif (this.channel_types === undefined) {\n\t\t\tReflect.set(this, 'channel_types', []);\n\t\t}\n\n\t\tthis.channel_types!.push(...channelTypesPredicate.parse(channelTypes));\n\n\t\treturn this;\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandOptionType, type APIApplicationCommandIntegerOption } from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { ApplicationCommandNumericOptionMinMaxValueMixin } from '../mixins/ApplicationCommandNumericOptionMinMaxValueMixin.js';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\nimport { ApplicationCommandOptionWithChoicesAndAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.js';\n\nconst numberValidator = s.number.int;\n\n/**\n * A slash command integer option.\n */\n@mix(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin)\nexport class SlashCommandIntegerOption\n\textends ApplicationCommandOptionBase\n\timplements ApplicationCommandNumericOptionMinMaxValueMixin\n{\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.Integer as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue}\n\t */\n\tpublic setMaxValue(max: number): this {\n\t\tnumberValidator.parse(max);\n\n\t\tReflect.set(this, 'max_value', max);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue}\n\t */\n\tpublic setMinValue(min: number): this {\n\t\tnumberValidator.parse(min);\n\n\t\tReflect.set(this, 'min_value', min);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandIntegerOption {\n\t\tthis.runRequiredValidations();\n\n\t\tif (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\treturn { ...this } as APIApplicationCommandIntegerOption;\n\t}\n}\n\nexport interface SlashCommandIntegerOption\n\textends ApplicationCommandNumericOptionMinMaxValueMixin,\n\t\tApplicationCommandOptionWithChoicesAndAutocompleteMixin {}\n","/**\n * This mixin holds minimum and maximum symbols used for options.\n */\nexport abstract class ApplicationCommandNumericOptionMinMaxValueMixin {\n\t/**\n\t * The maximum value of this option.\n\t */\n\tpublic readonly max_value?: number;\n\n\t/**\n\t * The minimum value of this option.\n\t */\n\tpublic readonly min_value?: number;\n\n\t/**\n\t * Sets the maximum number value of this option.\n\t *\n\t * @param max - The maximum value this option can be\n\t */\n\tpublic abstract setMaxValue(max: number): this;\n\n\t/**\n\t * Sets the minimum number value of this option.\n\t *\n\t * @param min - The minimum value this option can be\n\t */\n\tpublic abstract setMinValue(min: number): this;\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandOptionType, type APIApplicationCommandOptionChoice } from 'discord-api-types/v10';\nimport { localizationMapPredicate, validateChoicesLength } from '../Assertions.js';\n\nconst stringPredicate = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);\nconst numberPredicate = s.number.greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);\nconst choicesPredicate = s.object({\n\tname: stringPredicate,\n\tname_localizations: localizationMapPredicate,\n\tvalue: s.union(stringPredicate, numberPredicate),\n}).array;\nconst booleanPredicate = s.boolean;\n\n/**\n * This mixin holds choices and autocomplete symbols used for options.\n */\nexport class ApplicationCommandOptionWithChoicesAndAutocompleteMixin {\n\t/**\n\t * The choices of this option.\n\t */\n\tpublic readonly choices?: APIApplicationCommandOptionChoice[];\n\n\t/**\n\t * Whether this option utilizes autocomplete.\n\t */\n\tpublic readonly autocomplete?: boolean;\n\n\t/**\n\t * The type of this option.\n\t *\n\t * @privateRemarks Since this is present and this is a mixin, this is needed.\n\t */\n\tpublic readonly type!: ApplicationCommandOptionType;\n\n\t/**\n\t * Adds multiple choices to this option.\n\t *\n\t * @param choices - The choices to add\n\t */\n\tpublic addChoices(...choices: APIApplicationCommandOptionChoice[]): this {\n\t\tif (choices.length > 0 && this.autocomplete) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tchoicesPredicate.parse(choices);\n\n\t\tif (this.choices === undefined) {\n\t\t\tReflect.set(this, 'choices', []);\n\t\t}\n\n\t\tvalidateChoicesLength(choices.length, this.choices);\n\n\t\tfor (const { name, name_localizations, value } of choices) {\n\t\t\t// Validate the value\n\t\t\tif (this.type === ApplicationCommandOptionType.String) {\n\t\t\t\tstringPredicate.parse(value);\n\t\t\t} else {\n\t\t\t\tnumberPredicate.parse(value);\n\t\t\t}\n\n\t\t\tthis.choices!.push({ name, name_localizations, value });\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets multiple choices for this option.\n\t *\n\t * @param choices - The choices to set\n\t */\n\tpublic setChoices[]>(...choices: Input): this {\n\t\tif (choices.length > 0 && this.autocomplete) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tchoicesPredicate.parse(choices);\n\n\t\tReflect.set(this, 'choices', []);\n\t\tthis.addChoices(...choices);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Whether this option uses autocomplete.\n\t *\n\t * @param autocomplete - Whether this option should use autocomplete\n\t */\n\tpublic setAutocomplete(autocomplete: boolean): this {\n\t\t// Assert that you actually passed a boolean\n\t\tbooleanPredicate.parse(autocomplete);\n\n\t\tif (autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\tReflect.set(this, 'autocomplete', autocomplete);\n\n\t\treturn this;\n\t}\n}\n","import { ApplicationCommandOptionType, type APIApplicationCommandMentionableOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command mentionable option.\n */\nexport class SlashCommandMentionableOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.Mentionable as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandMentionableOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandOptionType, type APIApplicationCommandNumberOption } from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { ApplicationCommandNumericOptionMinMaxValueMixin } from '../mixins/ApplicationCommandNumericOptionMinMaxValueMixin.js';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\nimport { ApplicationCommandOptionWithChoicesAndAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.js';\n\nconst numberValidator = s.number;\n\n/**\n * A slash command number option.\n */\n@mix(ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin)\nexport class SlashCommandNumberOption\n\textends ApplicationCommandOptionBase\n\timplements ApplicationCommandNumericOptionMinMaxValueMixin\n{\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.Number as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue}\n\t */\n\tpublic setMaxValue(max: number): this {\n\t\tnumberValidator.parse(max);\n\n\t\tReflect.set(this, 'max_value', max);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMinValue}\n\t */\n\tpublic setMinValue(min: number): this {\n\t\tnumberValidator.parse(min);\n\n\t\tReflect.set(this, 'min_value', min);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandNumberOption {\n\t\tthis.runRequiredValidations();\n\n\t\tif (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\treturn { ...this } as APIApplicationCommandNumberOption;\n\t}\n}\n\nexport interface SlashCommandNumberOption\n\textends ApplicationCommandNumericOptionMinMaxValueMixin,\n\t\tApplicationCommandOptionWithChoicesAndAutocompleteMixin {}\n","import { ApplicationCommandOptionType, type APIApplicationCommandRoleOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command role option.\n */\nexport class SlashCommandRoleOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic override readonly type = ApplicationCommandOptionType.Role as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandRoleOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandOptionType, type APIApplicationCommandStringOption } from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\nimport { ApplicationCommandOptionWithChoicesAndAutocompleteMixin } from '../mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.js';\n\nconst minLengthValidator = s.number.greaterThanOrEqual(0).lessThanOrEqual(6_000);\nconst maxLengthValidator = s.number.greaterThanOrEqual(1).lessThanOrEqual(6_000);\n\n/**\n * A slash command string option.\n */\n@mix(ApplicationCommandOptionWithChoicesAndAutocompleteMixin)\nexport class SlashCommandStringOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.String as const;\n\n\t/**\n\t * The maximum length of this option.\n\t */\n\tpublic readonly max_length?: number;\n\n\t/**\n\t * The minimum length of this option.\n\t */\n\tpublic readonly min_length?: number;\n\n\t/**\n\t * Sets the maximum length of this string option.\n\t *\n\t * @param max - The maximum length this option can be\n\t */\n\tpublic setMaxLength(max: number): this {\n\t\tmaxLengthValidator.parse(max);\n\n\t\tReflect.set(this, 'max_length', max);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum length of this string option.\n\t *\n\t * @param min - The minimum length this option can be\n\t */\n\tpublic setMinLength(min: number): this {\n\t\tminLengthValidator.parse(min);\n\n\t\tReflect.set(this, 'min_length', min);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandStringOption {\n\t\tthis.runRequiredValidations();\n\n\t\tif (this.autocomplete && Array.isArray(this.choices) && this.choices.length > 0) {\n\t\t\tthrow new RangeError('Autocomplete and choices are mutually exclusive to each other.');\n\t\t}\n\n\t\treturn { ...this } as APIApplicationCommandStringOption;\n\t}\n}\n\nexport interface SlashCommandStringOption extends ApplicationCommandOptionWithChoicesAndAutocompleteMixin {}\n","import { ApplicationCommandOptionType, type APIApplicationCommandUserOption } from 'discord-api-types/v10';\nimport { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';\n\n/**\n * A slash command user option.\n */\nexport class SlashCommandUserOption extends ApplicationCommandOptionBase {\n\t/**\n\t * The type of this option.\n\t */\n\tpublic readonly type = ApplicationCommandOptionType.User as const;\n\n\t/**\n\t * {@inheritDoc ApplicationCommandOptionBase.toJSON}\n\t */\n\tpublic toJSON(): APIApplicationCommandUserOption {\n\t\tthis.runRequiredValidations();\n\n\t\treturn { ...this };\n\t}\n}\n","import { assertReturnOfBuilder, validateMaxOptionsLength } from '../Assertions.js';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SlashCommandAttachmentOption } from '../options/attachment.js';\nimport { SlashCommandBooleanOption } from '../options/boolean.js';\nimport { SlashCommandChannelOption } from '../options/channel.js';\nimport { SlashCommandIntegerOption } from '../options/integer.js';\nimport { SlashCommandMentionableOption } from '../options/mentionable.js';\nimport { SlashCommandNumberOption } from '../options/number.js';\nimport { SlashCommandRoleOption } from '../options/role.js';\nimport { SlashCommandStringOption } from '../options/string.js';\nimport { SlashCommandUserOption } from '../options/user.js';\nimport type { ApplicationCommandOptionBase } from './ApplicationCommandOptionBase.js';\n\n/**\n * This mixin holds symbols that can be shared in slash command options.\n *\n * @typeParam ShouldOmitSubcommandFunctions - Whether to omit subcommand functions.\n */\nexport class SharedSlashCommandOptions {\n\tpublic readonly options!: ToAPIApplicationCommandOptions[];\n\n\t/**\n\t * Adds a boolean option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addBooleanOption(\n\t\tinput: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandBooleanOption);\n\t}\n\n\t/**\n\t * Adds a user option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandUserOption);\n\t}\n\n\t/**\n\t * Adds a channel option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addChannelOption(\n\t\tinput: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandChannelOption);\n\t}\n\n\t/**\n\t * Adds a role option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandRoleOption);\n\t}\n\n\t/**\n\t * Adds an attachment option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addAttachmentOption(\n\t\tinput: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandAttachmentOption);\n\t}\n\n\t/**\n\t * Adds a mentionable option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addMentionableOption(\n\t\tinput: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandMentionableOption);\n\t}\n\n\t/**\n\t * Adds a string option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addStringOption(\n\t\tinput:\n\t\t\t| Omit\n\t\t\t| Omit\n\t\t\t| SlashCommandStringOption\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandStringOption,\n\t\t\t ) =>\n\t\t\t\t\t| Omit\n\t\t\t\t\t| Omit\n\t\t\t\t\t| SlashCommandStringOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandStringOption);\n\t}\n\n\t/**\n\t * Adds an integer option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addIntegerOption(\n\t\tinput:\n\t\t\t| Omit\n\t\t\t| Omit\n\t\t\t| SlashCommandIntegerOption\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandIntegerOption,\n\t\t\t ) =>\n\t\t\t\t\t| Omit\n\t\t\t\t\t| Omit\n\t\t\t\t\t| SlashCommandIntegerOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandIntegerOption);\n\t}\n\n\t/**\n\t * Adds a number option.\n\t *\n\t * @param input - A function that returns an option builder or an already built builder\n\t */\n\tpublic addNumberOption(\n\t\tinput:\n\t\t\t| Omit\n\t\t\t| Omit\n\t\t\t| SlashCommandNumberOption\n\t\t\t| ((\n\t\t\t\t\tbuilder: SlashCommandNumberOption,\n\t\t\t ) =>\n\t\t\t\t\t| Omit\n\t\t\t\t\t| Omit\n\t\t\t\t\t| SlashCommandNumberOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandNumberOption);\n\t}\n\n\t/**\n\t * Where the actual adding magic happens. ✨\n\t *\n\t * @param input - The input. What else?\n\t * @param Instance - The instance of whatever is being added\n\t * @internal\n\t */\n\tprivate _sharedAddOptionMethod(\n\t\tinput:\n\t\t\t| Omit\n\t\t\t| Omit\n\t\t\t| OptionBuilder\n\t\t\t| ((\n\t\t\t\t\tbuilder: OptionBuilder,\n\t\t\t ) => Omit | Omit | OptionBuilder),\n\t\tInstance: new () => OptionBuilder,\n\t): ShouldOmitSubcommandFunctions extends true ? Omit : this {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new Instance()) : input;\n\n\t\tassertReturnOfBuilder(result, Instance);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n}\n","import { s } from '@sapphire/shapeshift';\nimport { ApplicationCommandType } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../../util/validation.js';\nimport type { ContextMenuCommandType } from './ContextMenuCommandBuilder.js';\n\nconst namePredicate = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(32)\n\t// eslint-disable-next-line prefer-named-capture-group\n\t.regex(/^( *[\\p{P}\\p{L}\\p{N}\\p{sc=Devanagari}\\p{sc=Thai}]+ *)+$/u)\n\t.setValidationEnabled(isValidationEnabled);\nconst typePredicate = s\n\t.union(s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message))\n\t.setValidationEnabled(isValidationEnabled);\nconst booleanPredicate = s.boolean;\n\nexport function validateDefaultPermission(value: unknown): asserts value is boolean {\n\tbooleanPredicate.parse(value);\n}\n\nexport function validateName(name: unknown): asserts name is string {\n\tnamePredicate.parse(name);\n}\n\nexport function validateType(type: unknown): asserts type is ContextMenuCommandType {\n\ttypePredicate.parse(type);\n}\n\nexport function validateRequiredParameters(name: string, type: number) {\n\t// Assert name matches all conditions\n\tvalidateName(name);\n\n\t// Assert type is valid\n\tvalidateType(type);\n}\n\nconst dmPermissionPredicate = s.boolean.nullish;\n\nexport function validateDMPermission(value: unknown): asserts value is boolean | null | undefined {\n\tdmPermissionPredicate.parse(value);\n}\n\nconst memberPermissionPredicate = s.union(\n\ts.bigint.transform((value) => value.toString()),\n\ts.number.safeInt.transform((value) => value.toString()),\n\ts.string.regex(/^\\d+$/),\n).nullish;\n\nexport function validateDefaultMemberPermissions(permissions: unknown) {\n\treturn memberPermissionPredicate.parse(permissions);\n}\n","import type {\n\tApplicationCommandType,\n\tLocaleString,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIContextMenuApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { validateLocale, validateLocalizationMap } from '../slashCommands/Assertions.js';\nimport {\n\tvalidateRequiredParameters,\n\tvalidateName,\n\tvalidateType,\n\tvalidateDefaultPermission,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDMPermission,\n} from './Assertions.js';\n\n/**\n * The type a context menu command can be.\n */\nexport type ContextMenuCommandType = ApplicationCommandType.Message | ApplicationCommandType.User;\n\n/**\n * A builder that creates API-compatible JSON data for context menu commands.\n */\nexport class ContextMenuCommandBuilder {\n\t/**\n\t * The name of this command.\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The name localizations of this command.\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The type of this command.\n\t */\n\tpublic readonly type: ContextMenuCommandType = undefined!;\n\n\t/**\n\t * Whether this command is enabled by default when the application is added to a guild.\n\t *\n\t * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead.\n\t */\n\tpublic readonly default_permission: boolean | undefined = undefined;\n\n\t/**\n\t * The set of permissions represented as a bit set for the command.\n\t */\n\tpublic readonly default_member_permissions: Permissions | null | undefined = undefined;\n\n\t/**\n\t * Indicates whether the command is available in direct messages with the application.\n\t *\n\t * @remarks\n\t * By default, commands are visible. This property is only for global commands.\n\t */\n\tpublic readonly dm_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Sets the name of this command.\n\t *\n\t * @param name - The name to use\n\t */\n\tpublic setName(name: string) {\n\t\t// Assert the name matches the conditions\n\t\tvalidateName(name);\n\n\t\tReflect.set(this, 'name', name);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the type of this command.\n\t *\n\t * @param type - The type to use\n\t */\n\tpublic setType(type: ContextMenuCommandType) {\n\t\t// Assert the type is valid\n\t\tvalidateType(type);\n\n\t\tReflect.set(this, 'type', type);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * @remarks\n\t * If set to `false`, you will have to later `PUT` the permissions for this command.\n\t * @param value - Whether to enable this command by default\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t * @deprecated Use {@link ContextMenuCommandBuilder.setDefaultMemberPermissions} or {@link ContextMenuCommandBuilder.setDMPermission} instead.\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'default_permission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the default permissions a member should have in order to run this command.\n\t *\n\t * @remarks\n\t * You can set this to `'0'` to disable the command by default.\n\t * @param permissions - The permissions bit field to set\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t */\n\tpublic setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined) {\n\t\t// Assert the value and parse it\n\t\tconst permissionValue = validateDefaultMemberPermissions(permissions);\n\n\t\tReflect.set(this, 'default_member_permissions', permissionValue);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets if the command is available in direct messages with the application.\n\t *\n\t * @remarks\n\t * By default, commands are visible. This method is only for global commands.\n\t * @param enabled - Whether the command should be enabled in direct messages\n\t * @see {@link https://discord.com/developers/docs/interactions/application-commands#permissions}\n\t */\n\tpublic setDMPermission(enabled: boolean | null | undefined) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDMPermission(enabled);\n\n\t\tReflect.set(this, 'dm_permission', enabled);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets a name localization for this command.\n\t *\n\t * @param locale - The locale to set\n\t * @param localizedName - The localized name for the given `locale`\n\t */\n\tpublic setNameLocalization(locale: LocaleString, localizedName: string | null) {\n\t\tif (!this.name_localizations) {\n\t\t\tReflect.set(this, 'name_localizations', {});\n\t\t}\n\n\t\tconst parsedLocale = validateLocale(locale);\n\n\t\tif (localizedName === null) {\n\t\t\tthis.name_localizations![parsedLocale] = null;\n\t\t\treturn this;\n\t\t}\n\n\t\tvalidateName(localizedName);\n\n\t\tthis.name_localizations![parsedLocale] = localizedName;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the name localizations for this command.\n\t *\n\t * @param localizedNames - The object of localized names to set\n\t */\n\tpublic setNameLocalizations(localizedNames: LocalizationMap | null) {\n\t\tif (localizedNames === null) {\n\t\t\tReflect.set(this, 'name_localizations', null);\n\t\t\treturn this;\n\t\t}\n\n\t\tReflect.set(this, 'name_localizations', {});\n\n\t\tfor (const args of Object.entries(localizedNames))\n\t\t\tthis.setNameLocalization(...(args as [LocaleString, string | null]));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Serializes this builder to API-compatible JSON data.\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\n\t */\n\tpublic toJSON(): RESTPostAPIContextMenuApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.type);\n\n\t\tvalidateLocalizationMap(this.name_localizations);\n\n\t\treturn { ...this };\n\t}\n}\n","import type { APIEmbed } from 'discord-api-types/v10';\n\n/**\n * Calculates the length of the embed.\n *\n * @param data - The embed data to check\n */\nexport function embedLength(data: APIEmbed) {\n\treturn (\n\t\t(data.title?.length ?? 0) +\n\t\t(data.description?.length ?? 0) +\n\t\t(data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) +\n\t\t(data.footer?.text.length ?? 0) +\n\t\t(data.author?.name.length ?? 0)\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,SAAS;;;ACAlB,IAAI,WAAW;AAOR,SAAS,mBAAmB;AAClC,SAAQ,WAAW;AACpB;AAFgB;AAST,SAAS,oBAAoB;AACnC,SAAQ,WAAW;AACpB;AAFgB;AAOT,SAAS,sBAAsB;AACrC,SAAO;AACR;AAFgB;;;ADnBT,IAAM,qBAAqB,EAAE,OAClC,yBAAyB,CAAC,EAC1B,sBAAsB,GAAG,EACzB,qBAAqB,mBAAmB;AAEnC,IAAM,sBAAsB,EAAE,OACnC,yBAAyB,CAAC,EAC1B,sBAAsB,IAAK,EAC3B,qBAAqB,mBAAmB;AAEnC,IAAM,uBAAuB,EAAE,QAAQ;AAEvC,IAAM,sBAAsB,EACjC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACT,CAAC,EACA,qBAAqB,mBAAmB;AAEnC,IAAM,4BAA4B,oBAAoB,MAAM,qBAAqB,mBAAmB;AAEpG,IAAM,uBAAuB,EAAE,OAAO,gBAAgB,EAAE,EAAE,qBAAqB,mBAAmB;AAElG,SAAS,oBAAoB,cAAsB,QAAgC;AACzF,uBAAqB,OAAO,QAAQ,UAAU,KAAK,YAAY;AAChE;AAFgB;AAIT,IAAM,sBAAsB,mBAAmB,SAAS,qBAAqB,mBAAmB;AAEhG,IAAM,oBAA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AsB,CAAC,CAAC;AAAA,IAC3C;AAEA,UAAM,eAAe,eAAe,MAAM;AAE1C,QAAI,kBAAkB,MAAM;AAC3B,WAAK,mBAAoB,YAAY,IAAI;AACzC,aAAO;AAAA,IACR;AAEA,IAAAH,cAAa,aAAa;AAE1B,SAAK,mBAAoB,YAAY,IAAI;AACzC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,qBAAqB,gBAAwC;AACnE,QAAI,mBAAmB,MAAM;AAC5B,cAAQ,IAAI,MAAM,sBAAsB,IAAI;AAC5C,aAAO;AAAA,IACR;AAEA,YAAQ,IAAI,MAAM,sBAAsB,CAAC,CAAC;AAE1C,eAAW,QAAQ,OAAO,QAAQ,cAAc;AAC/C,WAAK,oBAAoB,GAAI,IAAsC;AACpE,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,SAA4D;AAClE,IAAAI,4BAA2B,KAAK,MAAM,KAAK,IAAI;AAE/C,4BAAwB,KAAK,kBAAkB;AAE/C,WAAO,EAAE,GAAG,KAAK;AAAA,EAClB;AACD;;;AC9LO,SAAS,YAAY,MAAgB;AAC3C,UACE,KAAK,OAAO,UAAU,MACtB,KAAK,aAAa,UAAU,MAC5B,KAAK,QAAQ,OAAO,CAAC,MAAM,SAAS,OAAO,KAAK,KAAK,SAAS,KAAK,MAAM,QAAQ,CAAC,KAAK,MACvF,KAAK,QAAQ,KAAK,UAAU,MAC5B,KAAK,QAAQ,KAAK,UAAU;AAE/B;AARgB;;;ArC6DT,IAAM,UAAU;","names":["Assertions_exports","s","s","ComponentType","ComponentType","ComponentType","ComponentType","ComponentType","SelectMenuDefaultValueType","ComponentType","SelectMenuDefaultValueType","ComponentType","SelectMenuDefaultValueType","ComponentType","SelectMenuDefaultValueType","ComponentType","ComponentType","ComponentType","SelectMenuDefaultValueType","ComponentType","SelectMenuDefaultValueType","ComponentType","Assertions_exports","placeholderValidator","s","s","placeholderValidator","ComponentType","placeholderValidator","ComponentType","ComponentType","Assertions_exports","validateRequiredParameters","s","s","validateRequiredParameters","validateRequiredParameters","Assertions_exports","validateRequiredParameters","s","s","descriptionPredicate","validateRequiredParameters","mix","ApplicationCommandOptionType","mix","validateRequiredParameters","ApplicationCommandOptionType","ApplicationCommandOptionType","ApplicationCommandOptionType","s","ChannelType","ChannelType","s","ApplicationCommandOptionType","s","ApplicationCommandOptionType","mix","s","ApplicationCommandOptionType","s","booleanPredicate","ApplicationCommandOptionType","s","ApplicationCommandOptionType","mix","ApplicationCommandOptionType","ApplicationCommandOptionType","s","ApplicationCommandOptionType","mix","numberValidator","s","ApplicationCommandOptionType","mix","ApplicationCommandOptionType","ApplicationCommandOptionType","s","ApplicationCommandOptionType","mix","minLengthValidator","s","maxLengthValidator","ApplicationCommandOptionType","mix","ApplicationCommandOptionType","ApplicationCommandOptionType","validateRequiredParameters","ApplicationCommandOptionType","mix","validateRequiredParameters","mix","Assertions_exports","validateDMPermission","validateDefaultMemberPermissions","validateDefaultPermission","validateName","validateRequiredParameters","s","namePredicate","s","booleanPredicate","validateDefaultPermission","validateName","validateRequiredParameters","dmPermissionPredicate","validateDMPermission","memberPermissionPredicate","validateDefaultMemberPermissions","validateName","validateDefaultPermission","validateDefaultMemberPermissions","validateDMPermission","validateRequiredParameters"]} \ No newline at end of file diff --git a/node_modules/@discordjs/builders/package.json b/node_modules/@discordjs/builders/package.json new file mode 100644 index 0000000..5084770 --- /dev/null +++ b/node_modules/@discordjs/builders/package.json @@ -0,0 +1,97 @@ +{ + "$schema": "https://json.schemastore.org/package.json", + "name": "@discordjs/builders", + "version": "1.7.0", + "description": "A set of builders that you can use when creating your bot", + "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": [ + "Vlad Frangu ", + "Crawl ", + "Amish Shah ", + "SpaceEEC ", + "Aura Román " + ], + "license": "Apache-2.0", + "keywords": [ + "discord", + "api", + "bot", + "client", + "node", + "discordapp", + "discordjs" + ], + "repository": { + "type": "git", + "url": "https://github.com/discordjs/discord.js.git", + "directory": "packages/builders" + }, + "bugs": { + "url": "https://github.com/discordjs/discord.js/issues" + }, + "homepage": "https://discord.js.org", + "dependencies": { + "@sapphire/shapeshift": "^3.9.3", + "discord-api-types": "0.37.61", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.3", + "tslib": "^2.6.2", + "@discordjs/formatters": "^0.3.3", + "@discordjs/util": "^1.0.2" + }, + "devDependencies": { + "@favware/cliff-jumper": "^2.2.1", + "@types/node": "16.18.60", + "@vitest/coverage-v8": "^0.34.6", + "cross-env": "^7.0.3", + "downlevel-dts": "^0.11.0", + "esbuild-plugin-version-injector": "^1.2.1", + "eslint": "^8.53.0", + "eslint-config-neon": "^0.1.57", + "eslint-formatter-pretty": "^5.0.0", + "prettier": "^3.0.3", + "tsup": "^7.2.0", + "turbo": "^1.10.17-canary.0", + "typescript": "^5.2.2", + "vitest": "^0.34.6", + "@discordjs/api-extractor": "^7.38.1" + }, + "engines": { + "node": ">=16.11.0" + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "test": "vitest run", + "build": "tsc --noEmit && tsup", + "build:docs": "tsc -p tsconfig.docs.json && downlevel-dts ./dist-docs ./dist-docs", + "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__", + "fmt": "pnpm run format", + "docs": "pnpm run build:docs && api-extractor run --local", + "changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/builders/*'", + "release": "cliff-jumper" + } +} \ No newline at end of file diff --git a/node_modules/@discordjs/collection/CHANGELOG.md b/node_modules/@discordjs/collection/CHANGELOG.md new file mode 100644 index 0000000..2c43057 --- /dev/null +++ b/node_modules/@discordjs/collection/CHANGELOG.md @@ -0,0 +1,190 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +# [@discordjs/collection@1.5.3](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.2...@discordjs/collection@1.5.3) - (2023-08-17) + +## Documentation + +- Update Node.js requirement to 16.11.0 (#9764) ([188877c](https://github.com/discordjs/discord.js/commit/188877c50af70f0d5cffb246620fa277435c6ce6)) + +# [@discordjs/collection@1.5.2](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.1...@discordjs/collection@1.5.2) - (2023-07-31) + +## Refactor + +- **collection:** Reduce `reduce`'s code (#9581) ([b85a3f2](https://github.com/discordjs/discord.js/commit/b85a3f2ddee8fc5974749b95fc07389a03093df2)) + +# [@discordjs/collection@1.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.0...@discordjs/collection@1.5.1) - (2023-05-01) + +## Bug Fixes + +- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2)) + +## Documentation + +- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9)) + +# [@discordjs/collection@1.5.2](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.1...@discordjs/collection@1.5.2) - (2023-07-31) + +## Refactor + +- **collection:** Reduce `reduce`'s code (#9581) ([b85a3f2](https://github.com/discordjs/discord.js/commit/b85a3f2ddee8fc5974749b95fc07389a03093df2)) + +# [@discordjs/collection@1.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.0...@discordjs/collection@1.5.1) - (2023-05-01) + +## Bug Fixes + +- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2)) + +## Documentation + +- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9)) + +# [@discordjs/collection@1.5.1](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.5.0...@discordjs/collection@1.5.1) - (2023-05-01) + +## Bug Fixes + +- Fix external links (#9313) ([a7425c2](https://github.com/discordjs/discord.js/commit/a7425c29c4f23f1b31f4c6a463107ca9eb7fd7e2)) + +## Documentation + +- Generate static imports for types with api-extractor ([98a76db](https://github.com/discordjs/discord.js/commit/98a76db482879f79d6bb2fb2e5fc65ac2c34e2d9)) + +# [@discordjs/collection@1.5.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.4.0...@discordjs/collection@1.5.0) - (2023-04-01) + +## Bug Fixes + +- **scripts:** Accessing tsComment ([d8d5f31](https://github.com/discordjs/discord.js/commit/d8d5f31d3927fd1de62f1fa3a1a6e454243ad87b)) + +## Features + +- **website:** Render syntax and mdx on the server (#9086) ([ee5169e](https://github.com/discordjs/discord.js/commit/ee5169e0aadd7bbfcd752aae614ec0f69602b68b)) + +## Refactor + +- **collection:** Fix/silence linter warnings (#9266) ([d6f4e60](https://github.com/discordjs/discord.js/commit/d6f4e60efd1a1796fc84dbbfbac4f9790e480a1c)) + +# [@discordjs/collection@1.4.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.3.0...@discordjs/collection@1.4.0) - (2023-03-12) + +## Documentation + +- Fix version export (#9049) ([8b70f49](https://github.com/discordjs/discord.js/commit/8b70f497a1207e30edebdecd12b926c981c13d28)) + +## Features + +- **website:** Add support for source file links (#9048) ([f6506e9](https://github.com/discordjs/discord.js/commit/f6506e99c496683ee0ab67db0726b105b929af38)) + +## Refactor + +- Compare with `undefined` directly (#9191) ([869153c](https://github.com/discordjs/discord.js/commit/869153c3fdf155783e7c0ecebd3627b087c3a026)) + +# [@discordjs/collection@1.3.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.2.0...@discordjs/collection@1.3.0) - (2022-11-28) + +## Bug Fixes + +- Pin @types/node version ([9d8179c](https://github.com/discordjs/discord.js/commit/9d8179c6a78e1c7f9976f852804055964d5385d4)) + +## Features + +- Add `Collection#subtract()` (#8393) ([291f36c](https://github.com/discordjs/discord.js/commit/291f36cd736b5dea058145a1335bf7c78ec1d81d)) + +# [@discordjs/collection@1.2.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.1.0...@discordjs/collection@1.2.0) - (2022-10-08) + +## Bug Fixes + +- Footer / sidebar / deprecation alert ([ba3e0ed](https://github.com/discordjs/discord.js/commit/ba3e0ed348258fe8e51eefb4aa7379a1230616a9)) + +## Documentation + +- Change name (#8604) ([dd5a089](https://github.com/discordjs/discord.js/commit/dd5a08944c258a847fc4377f1d5e953264ab47d0)) +- Remove xml tag from collection#find (#8550) ([4032457](https://github.com/discordjs/discord.js/commit/40324574ebea9894cadcc967e0db0e4e21d62768)) + +## Features + +- Web-components (#8715) ([0ac3e76](https://github.com/discordjs/discord.js/commit/0ac3e766bd9dbdeb106483fa4bb085d74de346a2)) + +## Refactor + +- Website components (#8600) ([c334157](https://github.com/discordjs/discord.js/commit/c3341570d983aea9ecc419979d5a01de658c9d67)) +- Use `eslint-config-neon` for packages. (#8579) ([edadb9f](https://github.com/discordjs/discord.js/commit/edadb9fe5dfd9ff51a3cfc9b25cb242d3f9f5241)) + +## Typings + +- **Collection:** Make fn return type unknown (#8676) ([822b7f2](https://github.com/discordjs/discord.js/commit/822b7f234af053c8f917b0a998b82abfccd33801)) + +# [@discordjs/collection@1.1.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@1.0.1...@discordjs/collection@1.1.0) - (2022-08-22) + +## Bug Fixes + +- Use proper format for `@link` text (#8384) ([2655639](https://github.com/discordjs/discord.js/commit/26556390a3800e954974a00c1328ff47d3e67e9a)) + +## Documentation + +- Fence examples in codeblocks ([193b252](https://github.com/discordjs/discord.js/commit/193b252672440a860318d3c2968aedd9cb88e0ce)) +- Use link tags (#8382) ([5494791](https://github.com/discordjs/discord.js/commit/549479131318c659f86f0eb18578d597e22522d3)) + +## Features + +- **website:** Show `constructor` information (#8540) ([e42fd16](https://github.com/discordjs/discord.js/commit/e42fd1636973b10dd7ed6fb4280ee1a4a8f82007)) +- **website:** Show descriptions for `@typeParam` blocks (#8523) ([e475b63](https://github.com/discordjs/discord.js/commit/e475b63f257f6261d73cb89fee9ecbcdd84e2a6b)) + +## Refactor + +- **website:** Adjust typography (#8503) ([0f83402](https://github.com/discordjs/discord.js/commit/0f834029850d2448981596cf082ff59917018d66)) +- Docs design (#8487) ([4ab1d09](https://github.com/discordjs/discord.js/commit/4ab1d09997a18879a9eb9bda39df6f15aa22557e)) + +# [@discordjs/collection@0.8.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@0.7.0...@discordjs/collection@0.8.0) - (2022-07-17) + +## Bug Fixes + +- **Collection:** Make error messages consistent (#8224) ([5bd6b28](https://github.com/discordjs/discord.js/commit/5bd6b28b3ebfced1cb9d23e83bd7c0def7a12404)) +- Check for function type (#8064) ([3bb9c0e](https://github.com/discordjs/discord.js/commit/3bb9c0e5c37311044ff41761b572ac4f91cda57c)) + +## Documentation + +- Add codecov coverage badge to readmes (#8226) ([f6db285](https://github.com/discordjs/discord.js/commit/f6db285c073898a749fe4591cbd4463d1896daf5)) + +## Features + +- Codecov (#8219) ([f10f4cd](https://github.com/discordjs/discord.js/commit/f10f4cdcd88ca6be7ec735ed3a415ba13da83db0)) +- **docgen:** Update typedoc ([b3346f4](https://github.com/discordjs/discord.js/commit/b3346f4b9b3d4f96443506643d4631dc1c6d7b21)) +- Website (#8043) ([127931d](https://github.com/discordjs/discord.js/commit/127931d1df7a2a5c27923c2f2151dbf3824e50cc)) +- **docgen:** Typescript support ([3279b40](https://github.com/discordjs/discord.js/commit/3279b40912e6aa61507bedb7db15a2b8668de44b)) +- Docgen package (#8029) ([8b979c0](https://github.com/discordjs/discord.js/commit/8b979c0245c42fd824d8e98745ee869f5360fc86)) +- Use vitest instead of jest for more speed ([8d8e6c0](https://github.com/discordjs/discord.js/commit/8d8e6c03decd7352a2aa180f6e5bc1a13602539b)) +- Add scripts package for locally used scripts ([f2ae1f9](https://github.com/discordjs/discord.js/commit/f2ae1f9348bfd893332a9060f71a8a5f272a1b8b)) + +## Refactor + +- **collection:** Remove `default` property (#8055) ([c8f1690](https://github.com/discordjs/discord.js/commit/c8f1690896f55f06e05a83704262783cfc2bb91d)) +- **collection:** Remove default export (#8053) ([16810f3](https://github.com/discordjs/discord.js/commit/16810f3e410bf35ed7e6e7412d517ea74c792c5d)) +- Move all the config files to root (#8033) ([769ea0b](https://github.com/discordjs/discord.js/commit/769ea0bfe78c4f1d413c6b397c604ffe91e39c6a)) + +## Testing + +- **collection:** Improve coverage (#8222) ([a51f721](https://github.com/discordjs/discord.js/commit/a51f7215eca67a0f46fba8b2d706f7ec6f6dc228)) + +# [@discordjs/collection@0.7.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@0.6.0...@discordjs/collection@0.7.0) - (2022-06-04) + +## Styling + +- Cleanup tests and tsup configs ([6b8ef20](https://github.com/discordjs/discord.js/commit/6b8ef20cb3af5b5cfd176dd0aa0a1a1e98551629)) + +# [@discordjs/collection@0.6.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@0.5.0...@discordjs/collection@0.6.0) - (2022-04-17) + +## Features + +- Add support for module: NodeNext in TS and ESM (#7598) ([8f1986a](https://github.com/discordjs/discord.js/commit/8f1986a6aa98365e09b00e84ad5f9f354ab61f3d)) +- **builders:** Add attachment command option type (#7203) ([ae0f35f](https://github.com/discordjs/discord.js/commit/ae0f35f51d68dfa5a7dc43d161ef9365171debdb)) +- **Collection:** Add merging functions (#7299) ([e4bd07b](https://github.com/discordjs/discord.js/commit/e4bd07b2394f227ea06b72eb6999de9ab3127b25)) + +# [@discordjs/collection@0.5.0](https://github.com/discordjs/discord.js/compare/@discordjs/collection@0.4.0...@discordjs/collection@0.5.0) - (2022-01-24) + +## Refactor + +- Make `intersect` perform a true intersection (#7211) ([d8efba2](https://github.com/discordjs/discord.js/commit/d8efba24e09aa2a8dbf028fc57a561a56e7833fd)) + +## Typings + +- Add `ReadonlyCollection` (#7245) ([db25f52](https://github.com/discordjs/discord.js/commit/db25f529b26d7c819c1c42ad3e26c2263ea2da0e)) +- **Collection:** Union types on `intersect` and `difference` (#7196) ([1f9b922](https://github.com/discordjs/discord.js/commit/1f9b9225f2066e9cc66c3355417139fd25cc403c)) diff --git a/node_modules/@discordjs/collection/LICENSE b/node_modules/@discordjs/collection/LICENSE new file mode 100644 index 0000000..d21f37a --- /dev/null +++ b/node_modules/@discordjs/collection/LICENSE @@ -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 2015 Amish Shah + + 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. diff --git a/node_modules/@discordjs/collection/README.md b/node_modules/@discordjs/collection/README.md new file mode 100644 index 0000000..4ddde14 --- /dev/null +++ b/node_modules/@discordjs/collection/README.md @@ -0,0 +1,67 @@ +
+
+

+ discord.js +

+
+

+ Discord server + npm version + npm downloads + Build status + Code coverage +

+

+ Vercel + Cloudflare Workers +

+
+ +## About + +`@discordjs/collection` is a powerful utility data structure used in discord.js. + +## Installation + +**Node.js 16.11.0 or newer is required.** + +```sh +npm install @discordjs/collection +yarn add @discordjs/collection +pnpm add @discordjs/collection +``` + +## 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/collection/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/collection +[npm]: https://www.npmjs.com/package/@discordjs/collection +[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries +[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md diff --git a/node_modules/@discordjs/collection/dist/index.d.mts b/node_modules/@discordjs/collection/dist/index.d.mts new file mode 100644 index 0000000..5990c61 --- /dev/null +++ b/node_modules/@discordjs/collection/dist/index.d.mts @@ -0,0 +1,457 @@ +/** + * @internal + */ +interface CollectionConstructor { + new (): Collection; + new (entries?: readonly (readonly [K, V])[] | null): Collection; + new (iterable: Iterable): Collection; + readonly prototype: Collection; + readonly [Symbol.species]: CollectionConstructor; +} +/** + * Represents an immutable version of a collection + */ +type ReadonlyCollection = Omit, 'delete' | 'ensure' | 'forEach' | 'get' | 'reverse' | 'set' | 'sort' | 'sweep'> & ReadonlyMap; +/** + * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself + * + * @internal + */ +interface Collection extends Map { + constructor: CollectionConstructor; +} +/** + * A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has + * an ID, for significantly improved performance and ease-of-use. + * + * @typeParam K - The key type this collection holds + * @typeParam V - The value type this collection holds + */ +declare class Collection extends Map { + /** + * Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator. + * + * @param key - The key to get if it exists, or set otherwise + * @param defaultValueGenerator - A function that generates the default value + * @example + * ```ts + * collection.ensure(guildId, () => defaultGuildConfig); + * ``` + */ + ensure(key: K, defaultValueGenerator: (key: K, collection: this) => V): V; + /** + * Checks if all of the elements exist in the collection. + * + * @param keys - The keys of the elements to check for + * @returns `true` if all of the elements exist, `false` if at least one does not exist. + */ + hasAll(...keys: K[]): boolean; + /** + * Checks if any of the elements exist in the collection. + * + * @param keys - The keys of the elements to check for + * @returns `true` if any of the elements exist, `false` if none exist. + */ + hasAny(...keys: K[]): boolean; + /** + * Obtains the first value(s) in this collection. + * + * @param amount - Amount of values to obtain from the beginning + * @returns A single value if no amount is provided or an array of values, starting from the end if amount is negative + */ + first(): V | undefined; + first(amount: number): V[]; + /** + * Obtains the first key(s) in this collection. + * + * @param amount - Amount of keys to obtain from the beginning + * @returns A single key if no amount is provided or an array of keys, starting from the end if + * amount is negative + */ + firstKey(): K | undefined; + firstKey(amount: number): K[]; + /** + * Obtains the last value(s) in this collection. + * + * @param amount - Amount of values to obtain from the end + * @returns A single value if no amount is provided or an array of values, starting from the start if + * amount is negative + */ + last(): V | undefined; + last(amount: number): V[]; + /** + * Obtains the last key(s) in this collection. + * + * @param amount - Amount of keys to obtain from the end + * @returns A single key if no amount is provided or an array of keys, starting from the start if + * amount is negative + */ + lastKey(): K | undefined; + lastKey(amount: number): K[]; + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}. + * Returns the item at a given index, allowing for positive and negative integers. + * Negative integers count back from the last item in the collection. + * + * @param index - The index of the element to obtain + */ + at(index: number): V | undefined; + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}. + * Returns the key at a given index, allowing for positive and negative integers. + * Negative integers count back from the last item in the collection. + * + * @param index - The index of the key to obtain + */ + keyAt(index: number): K | undefined; + /** + * Obtains unique random value(s) from this collection. + * + * @param amount - Amount of values to obtain randomly + * @returns A single value if no amount is provided or an array of values + */ + random(): V | undefined; + random(amount: number): V[]; + /** + * Obtains unique random key(s) from this collection. + * + * @param amount - Amount of keys to obtain randomly + * @returns A single key if no amount is provided or an array + */ + randomKey(): K | undefined; + randomKey(amount: number): K[]; + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse | Array.reverse()} + * but returns a Collection instead of an Array. + */ + reverse(): this; + /** + * Searches for a single item where the given function returns a truthy value. This behaves like + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find | Array.find()}. + * All collections used in Discord.js are mapped using their `id` property, and if you want to find by id you + * should use the `get` method. See + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get | MDN} for details. + * + * @param fn - The function to test with (should return boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.find(user => user.username === 'Bob'); + * ``` + */ + find(fn: (value: V, key: K, collection: this) => value is V2): V2 | undefined; + find(fn: (value: V, key: K, collection: this) => unknown): V | undefined; + find(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): V2 | undefined; + find(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): V | undefined; + /** + * Searches for the key of a single item where the given function returns a truthy value. This behaves like + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex | Array.findIndex()}, + * but returns the key rather than the positional index. + * + * @param fn - The function to test with (should return boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.findKey(user => user.username === 'Bob'); + * ``` + */ + findKey(fn: (value: V, key: K, collection: this) => key is K2): K2 | undefined; + findKey(fn: (value: V, key: K, collection: this) => unknown): K | undefined; + findKey(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): K2 | undefined; + findKey(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): K | undefined; + /** + * Removes items that satisfy the provided filter function. + * + * @param fn - Function used to test (should return a boolean) + * @param thisArg - Value to use as `this` when executing function + * @returns The number of removed entries + */ + sweep(fn: (value: V, key: K, collection: this) => unknown): number; + sweep(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): number; + /** + * Identical to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter | Array.filter()}, + * but returns a Collection instead of an Array. + * + * @param fn - The function to test with (should return boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.filter(user => user.username === 'Bob'); + * ``` + */ + filter(fn: (value: V, key: K, collection: this) => key is K2): Collection; + filter(fn: (value: V, key: K, collection: this) => value is V2): Collection; + filter(fn: (value: V, key: K, collection: this) => unknown): Collection; + filter(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): Collection; + filter(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): Collection; + filter(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): Collection; + /** + * Partitions the collection into two collections where the first collection + * contains the items that passed and the second contains the items that failed. + * + * @param fn - Function used to test (should return a boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * const [big, small] = collection.partition(guild => guild.memberCount > 250); + * ``` + */ + partition(fn: (value: V, key: K, collection: this) => key is K2): [Collection, Collection, V>]; + partition(fn: (value: V, key: K, collection: this) => value is V2): [Collection, Collection>]; + partition(fn: (value: V, key: K, collection: this) => unknown): [Collection, Collection]; + partition(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): [Collection, Collection, V>]; + partition(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): [Collection, Collection>]; + partition(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): [Collection, Collection]; + /** + * Maps each item into a Collection, then joins the results into a single Collection. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap | Array.flatMap()}. + * + * @param fn - Function that produces a new Collection + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.flatMap(guild => guild.members.cache); + * ``` + */ + flatMap(fn: (value: V, key: K, collection: this) => Collection): Collection; + flatMap(fn: (this: This, value: V, key: K, collection: this) => Collection, thisArg: This): Collection; + /** + * Maps each item to another value into an array. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}. + * + * @param fn - Function that produces an element of the new array, taking three arguments + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.map(user => user.tag); + * ``` + */ + map(fn: (value: V, key: K, collection: this) => T): T[]; + map(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): T[]; + /** + * Maps each item to another value into a collection. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}. + * + * @param fn - Function that produces an element of the new collection, taking three arguments + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.mapValues(user => user.tag); + * ``` + */ + mapValues(fn: (value: V, key: K, collection: this) => T): Collection; + mapValues(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): Collection; + /** + * Checks if there exists an item that passes a test. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some | Array.some()}. + * + * @param fn - Function used to test (should return a boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.some(user => user.discriminator === '0000'); + * ``` + */ + some(fn: (value: V, key: K, collection: this) => unknown): boolean; + some(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): boolean; + /** + * Checks if all items passes a test. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every | Array.every()}. + * + * @param fn - Function used to test (should return a boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.every(user => !user.bot); + * ``` + */ + every(fn: (value: V, key: K, collection: this) => key is K2): this is Collection; + every(fn: (value: V, key: K, collection: this) => value is V2): this is Collection; + every(fn: (value: V, key: K, collection: this) => unknown): boolean; + every(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): this is Collection; + every(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): this is Collection; + every(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): boolean; + /** + * Applies a function to produce a single value. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce | Array.reduce()}. + * + * @param fn - Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`, + * and `collection` + * @param initialValue - Starting value for the accumulator + * @example + * ```ts + * collection.reduce((acc, guild) => acc + guild.memberCount, 0); + * ``` + */ + reduce(fn: (accumulator: T, value: V, key: K, collection: this) => T, initialValue?: T): T; + /** + * Identical to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach | Map.forEach()}, + * but returns the collection instead of undefined. + * + * @param fn - Function to execute for each element + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection + * .each(user => console.log(user.username)) + * .filter(user => user.bot) + * .each(user => console.log(user.username)); + * ``` + */ + each(fn: (value: V, key: K, collection: this) => void): this; + each(fn: (this: T, value: V, key: K, collection: this) => void, thisArg: T): this; + /** + * Runs a function on the collection and returns the collection. + * + * @param fn - Function to execute + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection + * .tap(coll => console.log(coll.size)) + * .filter(user => user.bot) + * .tap(coll => console.log(coll.size)) + * ``` + */ + tap(fn: (collection: this) => void): this; + tap(fn: (this: T, collection: this) => void, thisArg: T): this; + /** + * Creates an identical shallow copy of this collection. + * + * @example + * ```ts + * const newColl = someColl.clone(); + * ``` + */ + clone(): Collection; + /** + * Combines this collection with others into a new collection. None of the source collections are modified. + * + * @param collections - Collections to merge + * @example + * ```ts + * const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl); + * ``` + */ + concat(...collections: ReadonlyCollection[]): Collection; + /** + * Checks if this collection shares identical items with another. + * This is different to checking for equality using equal-signs, because + * the collections may be different objects, but contain the same data. + * + * @param collection - Collection to compare with + * @returns Whether the collections have identical contents + */ + equals(collection: ReadonlyCollection): boolean; + /** + * The sort method sorts the items of a collection in place and returns it. + * The sort is not necessarily stable in Node 10 or older. + * The default sort order is according to string Unicode code points. + * + * @param compareFunction - Specifies a function that defines the sort order. + * If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element. + * @example + * ```ts + * collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp); + * ``` + */ + sort(compareFunction?: Comparator): this; + /** + * The intersect method returns a new structure containing items where the keys and values are present in both original structures. + * + * @param other - The other Collection to filter against + */ + intersect(other: ReadonlyCollection): Collection; + /** + * The subtract method returns a new structure containing items where the keys and values of the original structure are not present in the other. + * + * @param other - The other Collection to filter against + */ + subtract(other: ReadonlyCollection): Collection; + /** + * The difference method returns a new structure containing items where the key is present in one of the original structures but not the other. + * + * @param other - The other Collection to filter against + */ + difference(other: ReadonlyCollection): Collection; + /** + * Merges two Collections together into a new Collection. + * + * @param other - The other Collection to merge with + * @param whenInSelf - Function getting the result if the entry only exists in this Collection + * @param whenInOther - Function getting the result if the entry only exists in the other Collection + * @param whenInBoth - Function getting the result if the entry exists in both Collections + * @example + * ```ts + * // Sums up the entries in two collections. + * coll.merge( + * other, + * x => ({ keep: true, value: x }), + * y => ({ keep: true, value: y }), + * (x, y) => ({ keep: true, value: x + y }), + * ); + * ``` + * @example + * ```ts + * // Intersects two collections in a left-biased manner. + * coll.merge( + * other, + * x => ({ keep: false }), + * y => ({ keep: false }), + * (x, _) => ({ keep: true, value: x }), + * ); + * ``` + */ + merge(other: ReadonlyCollection, whenInSelf: (value: V, key: K) => Keep, whenInOther: (valueOther: T, key: K) => Keep, whenInBoth: (value: V, valueOther: T, key: K) => Keep): Collection; + /** + * The sorted method sorts the items of a collection and returns it. + * The sort is not necessarily stable in Node 10 or older. + * The default sort order is according to string Unicode code points. + * + * @param compareFunction - Specifies a function that defines the sort order. + * If omitted, the collection is sorted according to each character's Unicode code point value, + * according to the string conversion of each element. + * @example + * ```ts + * collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp); + * ``` + */ + sorted(compareFunction?: Comparator): Collection; + toJSON(): V[]; + private static defaultSort; + /** + * Creates a Collection from a list of entries. + * + * @param entries - The list of entries + * @param combine - Function to combine an existing entry with a new one + * @example + * ```ts + * Collection.combineEntries([["a", 1], ["b", 2], ["a", 2]], (x, y) => x + y); + * // returns Collection { "a" => 3, "b" => 2 } + * ``` + */ + static combineEntries(entries: Iterable<[K, V]>, combine: (firstValue: V, secondValue: V, key: K) => V): Collection; +} +/** + * @internal + */ +type Keep = { + keep: false; +} | { + keep: true; + value: V; +}; +/** + * @internal + */ +type Comparator = (firstValue: V, secondValue: V, firstKey: K, secondKey: K) => number; + +/** + * The {@link https://github.com/discordjs/discord.js/blob/main/packages/collection/#readme | @discordjs/collection} version + * that you are currently using. + */ +declare const version: string; + +export { Collection, CollectionConstructor, Comparator, Keep, ReadonlyCollection, version }; diff --git a/node_modules/@discordjs/collection/dist/index.d.ts b/node_modules/@discordjs/collection/dist/index.d.ts new file mode 100644 index 0000000..5990c61 --- /dev/null +++ b/node_modules/@discordjs/collection/dist/index.d.ts @@ -0,0 +1,457 @@ +/** + * @internal + */ +interface CollectionConstructor { + new (): Collection; + new (entries?: readonly (readonly [K, V])[] | null): Collection; + new (iterable: Iterable): Collection; + readonly prototype: Collection; + readonly [Symbol.species]: CollectionConstructor; +} +/** + * Represents an immutable version of a collection + */ +type ReadonlyCollection = Omit, 'delete' | 'ensure' | 'forEach' | 'get' | 'reverse' | 'set' | 'sort' | 'sweep'> & ReadonlyMap; +/** + * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself + * + * @internal + */ +interface Collection extends Map { + constructor: CollectionConstructor; +} +/** + * A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has + * an ID, for significantly improved performance and ease-of-use. + * + * @typeParam K - The key type this collection holds + * @typeParam V - The value type this collection holds + */ +declare class Collection extends Map { + /** + * Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator. + * + * @param key - The key to get if it exists, or set otherwise + * @param defaultValueGenerator - A function that generates the default value + * @example + * ```ts + * collection.ensure(guildId, () => defaultGuildConfig); + * ``` + */ + ensure(key: K, defaultValueGenerator: (key: K, collection: this) => V): V; + /** + * Checks if all of the elements exist in the collection. + * + * @param keys - The keys of the elements to check for + * @returns `true` if all of the elements exist, `false` if at least one does not exist. + */ + hasAll(...keys: K[]): boolean; + /** + * Checks if any of the elements exist in the collection. + * + * @param keys - The keys of the elements to check for + * @returns `true` if any of the elements exist, `false` if none exist. + */ + hasAny(...keys: K[]): boolean; + /** + * Obtains the first value(s) in this collection. + * + * @param amount - Amount of values to obtain from the beginning + * @returns A single value if no amount is provided or an array of values, starting from the end if amount is negative + */ + first(): V | undefined; + first(amount: number): V[]; + /** + * Obtains the first key(s) in this collection. + * + * @param amount - Amount of keys to obtain from the beginning + * @returns A single key if no amount is provided or an array of keys, starting from the end if + * amount is negative + */ + firstKey(): K | undefined; + firstKey(amount: number): K[]; + /** + * Obtains the last value(s) in this collection. + * + * @param amount - Amount of values to obtain from the end + * @returns A single value if no amount is provided or an array of values, starting from the start if + * amount is negative + */ + last(): V | undefined; + last(amount: number): V[]; + /** + * Obtains the last key(s) in this collection. + * + * @param amount - Amount of keys to obtain from the end + * @returns A single key if no amount is provided or an array of keys, starting from the start if + * amount is negative + */ + lastKey(): K | undefined; + lastKey(amount: number): K[]; + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}. + * Returns the item at a given index, allowing for positive and negative integers. + * Negative integers count back from the last item in the collection. + * + * @param index - The index of the element to obtain + */ + at(index: number): V | undefined; + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}. + * Returns the key at a given index, allowing for positive and negative integers. + * Negative integers count back from the last item in the collection. + * + * @param index - The index of the key to obtain + */ + keyAt(index: number): K | undefined; + /** + * Obtains unique random value(s) from this collection. + * + * @param amount - Amount of values to obtain randomly + * @returns A single value if no amount is provided or an array of values + */ + random(): V | undefined; + random(amount: number): V[]; + /** + * Obtains unique random key(s) from this collection. + * + * @param amount - Amount of keys to obtain randomly + * @returns A single key if no amount is provided or an array + */ + randomKey(): K | undefined; + randomKey(amount: number): K[]; + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse | Array.reverse()} + * but returns a Collection instead of an Array. + */ + reverse(): this; + /** + * Searches for a single item where the given function returns a truthy value. This behaves like + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find | Array.find()}. + * All collections used in Discord.js are mapped using their `id` property, and if you want to find by id you + * should use the `get` method. See + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get | MDN} for details. + * + * @param fn - The function to test with (should return boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.find(user => user.username === 'Bob'); + * ``` + */ + find(fn: (value: V, key: K, collection: this) => value is V2): V2 | undefined; + find(fn: (value: V, key: K, collection: this) => unknown): V | undefined; + find(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): V2 | undefined; + find(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): V | undefined; + /** + * Searches for the key of a single item where the given function returns a truthy value. This behaves like + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex | Array.findIndex()}, + * but returns the key rather than the positional index. + * + * @param fn - The function to test with (should return boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.findKey(user => user.username === 'Bob'); + * ``` + */ + findKey(fn: (value: V, key: K, collection: this) => key is K2): K2 | undefined; + findKey(fn: (value: V, key: K, collection: this) => unknown): K | undefined; + findKey(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): K2 | undefined; + findKey(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): K | undefined; + /** + * Removes items that satisfy the provided filter function. + * + * @param fn - Function used to test (should return a boolean) + * @param thisArg - Value to use as `this` when executing function + * @returns The number of removed entries + */ + sweep(fn: (value: V, key: K, collection: this) => unknown): number; + sweep(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): number; + /** + * Identical to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter | Array.filter()}, + * but returns a Collection instead of an Array. + * + * @param fn - The function to test with (should return boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.filter(user => user.username === 'Bob'); + * ``` + */ + filter(fn: (value: V, key: K, collection: this) => key is K2): Collection; + filter(fn: (value: V, key: K, collection: this) => value is V2): Collection; + filter(fn: (value: V, key: K, collection: this) => unknown): Collection; + filter(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): Collection; + filter(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): Collection; + filter(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): Collection; + /** + * Partitions the collection into two collections where the first collection + * contains the items that passed and the second contains the items that failed. + * + * @param fn - Function used to test (should return a boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * const [big, small] = collection.partition(guild => guild.memberCount > 250); + * ``` + */ + partition(fn: (value: V, key: K, collection: this) => key is K2): [Collection, Collection, V>]; + partition(fn: (value: V, key: K, collection: this) => value is V2): [Collection, Collection>]; + partition(fn: (value: V, key: K, collection: this) => unknown): [Collection, Collection]; + partition(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): [Collection, Collection, V>]; + partition(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): [Collection, Collection>]; + partition(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): [Collection, Collection]; + /** + * Maps each item into a Collection, then joins the results into a single Collection. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap | Array.flatMap()}. + * + * @param fn - Function that produces a new Collection + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.flatMap(guild => guild.members.cache); + * ``` + */ + flatMap(fn: (value: V, key: K, collection: this) => Collection): Collection; + flatMap(fn: (this: This, value: V, key: K, collection: this) => Collection, thisArg: This): Collection; + /** + * Maps each item to another value into an array. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}. + * + * @param fn - Function that produces an element of the new array, taking three arguments + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.map(user => user.tag); + * ``` + */ + map(fn: (value: V, key: K, collection: this) => T): T[]; + map(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): T[]; + /** + * Maps each item to another value into a collection. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}. + * + * @param fn - Function that produces an element of the new collection, taking three arguments + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.mapValues(user => user.tag); + * ``` + */ + mapValues(fn: (value: V, key: K, collection: this) => T): Collection; + mapValues(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): Collection; + /** + * Checks if there exists an item that passes a test. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some | Array.some()}. + * + * @param fn - Function used to test (should return a boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.some(user => user.discriminator === '0000'); + * ``` + */ + some(fn: (value: V, key: K, collection: this) => unknown): boolean; + some(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): boolean; + /** + * Checks if all items passes a test. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every | Array.every()}. + * + * @param fn - Function used to test (should return a boolean) + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection.every(user => !user.bot); + * ``` + */ + every(fn: (value: V, key: K, collection: this) => key is K2): this is Collection; + every(fn: (value: V, key: K, collection: this) => value is V2): this is Collection; + every(fn: (value: V, key: K, collection: this) => unknown): boolean; + every(fn: (this: This, value: V, key: K, collection: this) => key is K2, thisArg: This): this is Collection; + every(fn: (this: This, value: V, key: K, collection: this) => value is V2, thisArg: This): this is Collection; + every(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): boolean; + /** + * Applies a function to produce a single value. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce | Array.reduce()}. + * + * @param fn - Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`, + * and `collection` + * @param initialValue - Starting value for the accumulator + * @example + * ```ts + * collection.reduce((acc, guild) => acc + guild.memberCount, 0); + * ``` + */ + reduce(fn: (accumulator: T, value: V, key: K, collection: this) => T, initialValue?: T): T; + /** + * Identical to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach | Map.forEach()}, + * but returns the collection instead of undefined. + * + * @param fn - Function to execute for each element + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection + * .each(user => console.log(user.username)) + * .filter(user => user.bot) + * .each(user => console.log(user.username)); + * ``` + */ + each(fn: (value: V, key: K, collection: this) => void): this; + each(fn: (this: T, value: V, key: K, collection: this) => void, thisArg: T): this; + /** + * Runs a function on the collection and returns the collection. + * + * @param fn - Function to execute + * @param thisArg - Value to use as `this` when executing function + * @example + * ```ts + * collection + * .tap(coll => console.log(coll.size)) + * .filter(user => user.bot) + * .tap(coll => console.log(coll.size)) + * ``` + */ + tap(fn: (collection: this) => void): this; + tap(fn: (this: T, collection: this) => void, thisArg: T): this; + /** + * Creates an identical shallow copy of this collection. + * + * @example + * ```ts + * const newColl = someColl.clone(); + * ``` + */ + clone(): Collection; + /** + * Combines this collection with others into a new collection. None of the source collections are modified. + * + * @param collections - Collections to merge + * @example + * ```ts + * const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl); + * ``` + */ + concat(...collections: ReadonlyCollection[]): Collection; + /** + * Checks if this collection shares identical items with another. + * This is different to checking for equality using equal-signs, because + * the collections may be different objects, but contain the same data. + * + * @param collection - Collection to compare with + * @returns Whether the collections have identical contents + */ + equals(collection: ReadonlyCollection): boolean; + /** + * The sort method sorts the items of a collection in place and returns it. + * The sort is not necessarily stable in Node 10 or older. + * The default sort order is according to string Unicode code points. + * + * @param compareFunction - Specifies a function that defines the sort order. + * If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element. + * @example + * ```ts + * collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp); + * ``` + */ + sort(compareFunction?: Comparator): this; + /** + * The intersect method returns a new structure containing items where the keys and values are present in both original structures. + * + * @param other - The other Collection to filter against + */ + intersect(other: ReadonlyCollection): Collection; + /** + * The subtract method returns a new structure containing items where the keys and values of the original structure are not present in the other. + * + * @param other - The other Collection to filter against + */ + subtract(other: ReadonlyCollection): Collection; + /** + * The difference method returns a new structure containing items where the key is present in one of the original structures but not the other. + * + * @param other - The other Collection to filter against + */ + difference(other: ReadonlyCollection): Collection; + /** + * Merges two Collections together into a new Collection. + * + * @param other - The other Collection to merge with + * @param whenInSelf - Function getting the result if the entry only exists in this Collection + * @param whenInOther - Function getting the result if the entry only exists in the other Collection + * @param whenInBoth - Function getting the result if the entry exists in both Collections + * @example + * ```ts + * // Sums up the entries in two collections. + * coll.merge( + * other, + * x => ({ keep: true, value: x }), + * y => ({ keep: true, value: y }), + * (x, y) => ({ keep: true, value: x + y }), + * ); + * ``` + * @example + * ```ts + * // Intersects two collections in a left-biased manner. + * coll.merge( + * other, + * x => ({ keep: false }), + * y => ({ keep: false }), + * (x, _) => ({ keep: true, value: x }), + * ); + * ``` + */ + merge(other: ReadonlyCollection, whenInSelf: (value: V, key: K) => Keep, whenInOther: (valueOther: T, key: K) => Keep, whenInBoth: (value: V, valueOther: T, key: K) => Keep): Collection; + /** + * The sorted method sorts the items of a collection and returns it. + * The sort is not necessarily stable in Node 10 or older. + * The default sort order is according to string Unicode code points. + * + * @param compareFunction - Specifies a function that defines the sort order. + * If omitted, the collection is sorted according to each character's Unicode code point value, + * according to the string conversion of each element. + * @example + * ```ts + * collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp); + * ``` + */ + sorted(compareFunction?: Comparator): Collection; + toJSON(): V[]; + private static defaultSort; + /** + * Creates a Collection from a list of entries. + * + * @param entries - The list of entries + * @param combine - Function to combine an existing entry with a new one + * @example + * ```ts + * Collection.combineEntries([["a", 1], ["b", 2], ["a", 2]], (x, y) => x + y); + * // returns Collection { "a" => 3, "b" => 2 } + * ``` + */ + static combineEntries(entries: Iterable<[K, V]>, combine: (firstValue: V, secondValue: V, key: K) => V): Collection; +} +/** + * @internal + */ +type Keep = { + keep: false; +} | { + keep: true; + value: V; +}; +/** + * @internal + */ +type Comparator = (firstValue: V, secondValue: V, firstKey: K, secondKey: K) => number; + +/** + * The {@link https://github.com/discordjs/discord.js/blob/main/packages/collection/#readme | @discordjs/collection} version + * that you are currently using. + */ +declare const version: string; + +export { Collection, CollectionConstructor, Comparator, Keep, ReadonlyCollection, version }; diff --git a/node_modules/@discordjs/collection/dist/index.js b/node_modules/@discordjs/collection/dist/index.js new file mode 100644 index 0000000..d9379ea --- /dev/null +++ b/node_modules/@discordjs/collection/dist/index.js @@ -0,0 +1,543 @@ +"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, { + Collection: () => Collection, + version: () => version +}); +module.exports = __toCommonJS(src_exports); + +// src/collection.ts +var Collection = class _Collection extends Map { + static { + __name(this, "Collection"); + } + /** + * Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator. + * + * @param key - The key to get if it exists, or set otherwise + * @param defaultValueGenerator - A function that generates the default value + * @example + * ```ts + * collection.ensure(guildId, () => defaultGuildConfig); + * ``` + */ + ensure(key, defaultValueGenerator) { + if (this.has(key)) + return this.get(key); + if (typeof defaultValueGenerator !== "function") + throw new TypeError(`${defaultValueGenerator} is not a function`); + const defaultValue = defaultValueGenerator(key, this); + this.set(key, defaultValue); + return defaultValue; + } + /** + * Checks if all of the elements exist in the collection. + * + * @param keys - The keys of the elements to check for + * @returns `true` if all of the elements exist, `false` if at least one does not exist. + */ + hasAll(...keys) { + return keys.every((key) => super.has(key)); + } + /** + * Checks if any of the elements exist in the collection. + * + * @param keys - The keys of the elements to check for + * @returns `true` if any of the elements exist, `false` if none exist. + */ + hasAny(...keys) { + return keys.some((key) => super.has(key)); + } + first(amount) { + if (amount === void 0) + return this.values().next().value; + if (amount < 0) + return this.last(amount * -1); + amount = Math.min(this.size, amount); + const iter = this.values(); + return Array.from({ length: amount }, () => iter.next().value); + } + firstKey(amount) { + if (amount === void 0) + return this.keys().next().value; + if (amount < 0) + return this.lastKey(amount * -1); + amount = Math.min(this.size, amount); + const iter = this.keys(); + return Array.from({ length: amount }, () => iter.next().value); + } + last(amount) { + const arr = [...this.values()]; + if (amount === void 0) + return arr[arr.length - 1]; + if (amount < 0) + return this.first(amount * -1); + if (!amount) + return []; + return arr.slice(-amount); + } + lastKey(amount) { + const arr = [...this.keys()]; + if (amount === void 0) + return arr[arr.length - 1]; + if (amount < 0) + return this.firstKey(amount * -1); + if (!amount) + return []; + return arr.slice(-amount); + } + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}. + * Returns the item at a given index, allowing for positive and negative integers. + * Negative integers count back from the last item in the collection. + * + * @param index - The index of the element to obtain + */ + at(index) { + index = Math.floor(index); + const arr = [...this.values()]; + return arr.at(index); + } + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}. + * Returns the key at a given index, allowing for positive and negative integers. + * Negative integers count back from the last item in the collection. + * + * @param index - The index of the key to obtain + */ + keyAt(index) { + index = Math.floor(index); + const arr = [...this.keys()]; + return arr.at(index); + } + random(amount) { + const arr = [...this.values()]; + if (amount === void 0) + return arr[Math.floor(Math.random() * arr.length)]; + if (!arr.length || !amount) + return []; + return Array.from( + { length: Math.min(amount, arr.length) }, + () => arr.splice(Math.floor(Math.random() * arr.length), 1)[0] + ); + } + randomKey(amount) { + const arr = [...this.keys()]; + if (amount === void 0) + return arr[Math.floor(Math.random() * arr.length)]; + if (!arr.length || !amount) + return []; + return Array.from( + { length: Math.min(amount, arr.length) }, + () => arr.splice(Math.floor(Math.random() * arr.length), 1)[0] + ); + } + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse | Array.reverse()} + * but returns a Collection instead of an Array. + */ + reverse() { + const entries = [...this.entries()].reverse(); + this.clear(); + for (const [key, value] of entries) + this.set(key, value); + return this; + } + find(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (fn(val, key, this)) + return val; + } + return void 0; + } + findKey(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (fn(val, key, this)) + return key; + } + return void 0; + } + sweep(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const previousSize = this.size; + for (const [key, val] of this) { + if (fn(val, key, this)) + this.delete(key); + } + return previousSize - this.size; + } + filter(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const results = new this.constructor[Symbol.species](); + for (const [key, val] of this) { + if (fn(val, key, this)) + results.set(key, val); + } + return results; + } + partition(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const results = [ + new this.constructor[Symbol.species](), + new this.constructor[Symbol.species]() + ]; + for (const [key, val] of this) { + if (fn(val, key, this)) { + results[0].set(key, val); + } else { + results[1].set(key, val); + } + } + return results; + } + flatMap(fn, thisArg) { + const collections = this.map(fn, thisArg); + return new this.constructor[Symbol.species]().concat(...collections); + } + map(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const iter = this.entries(); + return Array.from({ length: this.size }, () => { + const [key, value] = iter.next().value; + return fn(value, key, this); + }); + } + mapValues(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const coll = new this.constructor[Symbol.species](); + for (const [key, val] of this) + coll.set(key, fn(val, key, this)); + return coll; + } + some(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (fn(val, key, this)) + return true; + } + return false; + } + every(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (!fn(val, key, this)) + return false; + } + return true; + } + /** + * Applies a function to produce a single value. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce | Array.reduce()}. + * + * @param fn - Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`, + * and `collection` + * @param initialValue - Starting value for the accumulator + * @example + * ```ts + * collection.reduce((acc, guild) => acc + guild.memberCount, 0); + * ``` + */ + reduce(fn, initialValue) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + let accumulator; + const iterator = this.entries(); + if (initialValue === void 0) { + if (this.size === 0) + throw new TypeError("Reduce of empty collection with no initial value"); + accumulator = iterator.next().value[1]; + } else { + accumulator = initialValue; + } + for (const [key, value] of iterator) { + accumulator = fn(accumulator, value, key, this); + } + return accumulator; + } + each(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, value] of this) { + fn(value, key, this); + } + return this; + } + tap(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + fn(this); + return this; + } + /** + * Creates an identical shallow copy of this collection. + * + * @example + * ```ts + * const newColl = someColl.clone(); + * ``` + */ + clone() { + return new this.constructor[Symbol.species](this); + } + /** + * Combines this collection with others into a new collection. None of the source collections are modified. + * + * @param collections - Collections to merge + * @example + * ```ts + * const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl); + * ``` + */ + concat(...collections) { + const newColl = this.clone(); + for (const coll of collections) { + for (const [key, val] of coll) + newColl.set(key, val); + } + return newColl; + } + /** + * Checks if this collection shares identical items with another. + * This is different to checking for equality using equal-signs, because + * the collections may be different objects, but contain the same data. + * + * @param collection - Collection to compare with + * @returns Whether the collections have identical contents + */ + equals(collection) { + if (!collection) + return false; + if (this === collection) + return true; + if (this.size !== collection.size) + return false; + for (const [key, value] of this) { + if (!collection.has(key) || value !== collection.get(key)) { + return false; + } + } + return true; + } + /** + * The sort method sorts the items of a collection in place and returns it. + * The sort is not necessarily stable in Node 10 or older. + * The default sort order is according to string Unicode code points. + * + * @param compareFunction - Specifies a function that defines the sort order. + * If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element. + * @example + * ```ts + * collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp); + * ``` + */ + sort(compareFunction = _Collection.defaultSort) { + const entries = [...this.entries()]; + entries.sort((a, b) => compareFunction(a[1], b[1], a[0], b[0])); + super.clear(); + for (const [key, value] of entries) { + super.set(key, value); + } + return this; + } + /** + * The intersect method returns a new structure containing items where the keys and values are present in both original structures. + * + * @param other - The other Collection to filter against + */ + intersect(other) { + const coll = new this.constructor[Symbol.species](); + for (const [key, value] of other) { + if (this.has(key) && Object.is(value, this.get(key))) { + coll.set(key, value); + } + } + return coll; + } + /** + * The subtract method returns a new structure containing items where the keys and values of the original structure are not present in the other. + * + * @param other - The other Collection to filter against + */ + subtract(other) { + const coll = new this.constructor[Symbol.species](); + for (const [key, value] of this) { + if (!other.has(key) || !Object.is(value, other.get(key))) { + coll.set(key, value); + } + } + return coll; + } + /** + * The difference method returns a new structure containing items where the key is present in one of the original structures but not the other. + * + * @param other - The other Collection to filter against + */ + difference(other) { + const coll = new this.constructor[Symbol.species](); + for (const [key, value] of other) { + if (!this.has(key)) + coll.set(key, value); + } + for (const [key, value] of this) { + if (!other.has(key)) + coll.set(key, value); + } + return coll; + } + /** + * Merges two Collections together into a new Collection. + * + * @param other - The other Collection to merge with + * @param whenInSelf - Function getting the result if the entry only exists in this Collection + * @param whenInOther - Function getting the result if the entry only exists in the other Collection + * @param whenInBoth - Function getting the result if the entry exists in both Collections + * @example + * ```ts + * // Sums up the entries in two collections. + * coll.merge( + * other, + * x => ({ keep: true, value: x }), + * y => ({ keep: true, value: y }), + * (x, y) => ({ keep: true, value: x + y }), + * ); + * ``` + * @example + * ```ts + * // Intersects two collections in a left-biased manner. + * coll.merge( + * other, + * x => ({ keep: false }), + * y => ({ keep: false }), + * (x, _) => ({ keep: true, value: x }), + * ); + * ``` + */ + merge(other, whenInSelf, whenInOther, whenInBoth) { + const coll = new this.constructor[Symbol.species](); + const keys = /* @__PURE__ */ new Set([...this.keys(), ...other.keys()]); + for (const key of keys) { + const hasInSelf = this.has(key); + const hasInOther = other.has(key); + if (hasInSelf && hasInOther) { + const result = whenInBoth(this.get(key), other.get(key), key); + if (result.keep) + coll.set(key, result.value); + } else if (hasInSelf) { + const result = whenInSelf(this.get(key), key); + if (result.keep) + coll.set(key, result.value); + } else if (hasInOther) { + const result = whenInOther(other.get(key), key); + if (result.keep) + coll.set(key, result.value); + } + } + return coll; + } + /** + * The sorted method sorts the items of a collection and returns it. + * The sort is not necessarily stable in Node 10 or older. + * The default sort order is according to string Unicode code points. + * + * @param compareFunction - Specifies a function that defines the sort order. + * If omitted, the collection is sorted according to each character's Unicode code point value, + * according to the string conversion of each element. + * @example + * ```ts + * collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp); + * ``` + */ + sorted(compareFunction = _Collection.defaultSort) { + return new this.constructor[Symbol.species](this).sort((av, bv, ak, bk) => compareFunction(av, bv, ak, bk)); + } + toJSON() { + return [...this.values()]; + } + static defaultSort(firstValue, secondValue) { + return Number(firstValue > secondValue) || Number(firstValue === secondValue) - 1; + } + /** + * Creates a Collection from a list of entries. + * + * @param entries - The list of entries + * @param combine - Function to combine an existing entry with a new one + * @example + * ```ts + * Collection.combineEntries([["a", 1], ["b", 2], ["a", 2]], (x, y) => x + y); + * // returns Collection { "a" => 3, "b" => 2 } + * ``` + */ + static combineEntries(entries, combine) { + const coll = new _Collection(); + for (const [key, value] of entries) { + if (coll.has(key)) { + coll.set(key, combine(coll.get(key), value, key)); + } else { + coll.set(key, value); + } + } + return coll; + } +}; + +// src/index.ts +var version = "1.5.3"; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + Collection, + version +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@discordjs/collection/dist/index.js.map b/node_modules/@discordjs/collection/dist/index.js.map new file mode 100644 index 0000000..247240c --- /dev/null +++ b/node_modules/@discordjs/collection/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.ts","../src/collection.ts"],"sourcesContent":["export * from './collection.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/collection/#readme | @discordjs/collection} version\n * that you are currently using.\n */\n// This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild\nexport const version = '1.5.3' as string;\n","/* eslint-disable no-param-reassign */\n/**\n * @internal\n */\nexport interface CollectionConstructor {\n\tnew (): Collection;\n\tnew (entries?: readonly (readonly [K, V])[] | null): Collection;\n\tnew (iterable: Iterable): Collection;\n\treadonly prototype: Collection;\n\treadonly [Symbol.species]: CollectionConstructor;\n}\n\n/**\n * Represents an immutable version of a collection\n */\nexport type ReadonlyCollection = Omit<\n\tCollection,\n\t'delete' | 'ensure' | 'forEach' | 'get' | 'reverse' | 'set' | 'sort' | 'sweep'\n> &\n\tReadonlyMap;\n\n/**\n * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself\n *\n * @internal\n */\nexport interface Collection extends Map {\n\tconstructor: CollectionConstructor;\n}\n\n/**\n * A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has\n * an ID, for significantly improved performance and ease-of-use.\n *\n * @typeParam K - The key type this collection holds\n * @typeParam V - The value type this collection holds\n */\nexport class Collection extends Map {\n\t/**\n\t * Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator.\n\t *\n\t * @param key - The key to get if it exists, or set otherwise\n\t * @param defaultValueGenerator - A function that generates the default value\n\t * @example\n\t * ```ts\n\t * collection.ensure(guildId, () => defaultGuildConfig);\n\t * ```\n\t */\n\tpublic ensure(key: K, defaultValueGenerator: (key: K, collection: this) => V): V {\n\t\tif (this.has(key)) return this.get(key)!;\n\t\tif (typeof defaultValueGenerator !== 'function') throw new TypeError(`${defaultValueGenerator} is not a function`);\n\t\tconst defaultValue = defaultValueGenerator(key, this);\n\t\tthis.set(key, defaultValue);\n\t\treturn defaultValue;\n\t}\n\n\t/**\n\t * Checks if all of the elements exist in the collection.\n\t *\n\t * @param keys - The keys of the elements to check for\n\t * @returns `true` if all of the elements exist, `false` if at least one does not exist.\n\t */\n\tpublic hasAll(...keys: K[]) {\n\t\treturn keys.every((key) => super.has(key));\n\t}\n\n\t/**\n\t * Checks if any of the elements exist in the collection.\n\t *\n\t * @param keys - The keys of the elements to check for\n\t * @returns `true` if any of the elements exist, `false` if none exist.\n\t */\n\tpublic hasAny(...keys: K[]) {\n\t\treturn keys.some((key) => super.has(key));\n\t}\n\n\t/**\n\t * Obtains the first value(s) in this collection.\n\t *\n\t * @param amount - Amount of values to obtain from the beginning\n\t * @returns A single value if no amount is provided or an array of values, starting from the end if amount is negative\n\t */\n\tpublic first(): V | undefined;\n\tpublic first(amount: number): V[];\n\tpublic first(amount?: number): V | V[] | undefined {\n\t\tif (amount === undefined) return this.values().next().value;\n\t\tif (amount < 0) return this.last(amount * -1);\n\t\tamount = Math.min(this.size, amount);\n\t\tconst iter = this.values();\n\t\treturn Array.from({ length: amount }, (): V => iter.next().value);\n\t}\n\n\t/**\n\t * Obtains the first key(s) in this collection.\n\t *\n\t * @param amount - Amount of keys to obtain from the beginning\n\t * @returns A single key if no amount is provided or an array of keys, starting from the end if\n\t * amount is negative\n\t */\n\tpublic firstKey(): K | undefined;\n\tpublic firstKey(amount: number): K[];\n\tpublic firstKey(amount?: number): K | K[] | undefined {\n\t\tif (amount === undefined) return this.keys().next().value;\n\t\tif (amount < 0) return this.lastKey(amount * -1);\n\t\tamount = Math.min(this.size, amount);\n\t\tconst iter = this.keys();\n\t\treturn Array.from({ length: amount }, (): K => iter.next().value);\n\t}\n\n\t/**\n\t * Obtains the last value(s) in this collection.\n\t *\n\t * @param amount - Amount of values to obtain from the end\n\t * @returns A single value if no amount is provided or an array of values, starting from the start if\n\t * amount is negative\n\t */\n\tpublic last(): V | undefined;\n\tpublic last(amount: number): V[];\n\tpublic last(amount?: number): V | V[] | undefined {\n\t\tconst arr = [...this.values()];\n\t\tif (amount === undefined) return arr[arr.length - 1];\n\t\tif (amount < 0) return this.first(amount * -1);\n\t\tif (!amount) return [];\n\t\treturn arr.slice(-amount);\n\t}\n\n\t/**\n\t * Obtains the last key(s) in this collection.\n\t *\n\t * @param amount - Amount of keys to obtain from the end\n\t * @returns A single key if no amount is provided or an array of keys, starting from the start if\n\t * amount is negative\n\t */\n\tpublic lastKey(): K | undefined;\n\tpublic lastKey(amount: number): K[];\n\tpublic lastKey(amount?: number): K | K[] | undefined {\n\t\tconst arr = [...this.keys()];\n\t\tif (amount === undefined) return arr[arr.length - 1];\n\t\tif (amount < 0) return this.firstKey(amount * -1);\n\t\tif (!amount) return [];\n\t\treturn arr.slice(-amount);\n\t}\n\n\t/**\n\t * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}.\n\t * Returns the item at a given index, allowing for positive and negative integers.\n\t * Negative integers count back from the last item in the collection.\n\t *\n\t * @param index - The index of the element to obtain\n\t */\n\tpublic at(index: number) {\n\t\tindex = Math.floor(index);\n\t\tconst arr = [...this.values()];\n\t\treturn arr.at(index);\n\t}\n\n\t/**\n\t * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}.\n\t * Returns the key at a given index, allowing for positive and negative integers.\n\t * Negative integers count back from the last item in the collection.\n\t *\n\t * @param index - The index of the key to obtain\n\t */\n\tpublic keyAt(index: number) {\n\t\tindex = Math.floor(index);\n\t\tconst arr = [...this.keys()];\n\t\treturn arr.at(index);\n\t}\n\n\t/**\n\t * Obtains unique random value(s) from this collection.\n\t *\n\t * @param amount - Amount of values to obtain randomly\n\t * @returns A single value if no amount is provided or an array of values\n\t */\n\tpublic random(): V | undefined;\n\tpublic random(amount: number): V[];\n\tpublic random(amount?: number): V | V[] | undefined {\n\t\tconst arr = [...this.values()];\n\t\tif (amount === undefined) return arr[Math.floor(Math.random() * arr.length)];\n\t\tif (!arr.length || !amount) return [];\n\t\treturn Array.from(\n\t\t\t{ length: Math.min(amount, arr.length) },\n\t\t\t(): V => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]!,\n\t\t);\n\t}\n\n\t/**\n\t * Obtains unique random key(s) from this collection.\n\t *\n\t * @param amount - Amount of keys to obtain randomly\n\t * @returns A single key if no amount is provided or an array\n\t */\n\tpublic randomKey(): K | undefined;\n\tpublic randomKey(amount: number): K[];\n\tpublic randomKey(amount?: number): K | K[] | undefined {\n\t\tconst arr = [...this.keys()];\n\t\tif (amount === undefined) return arr[Math.floor(Math.random() * arr.length)];\n\t\tif (!arr.length || !amount) return [];\n\t\treturn Array.from(\n\t\t\t{ length: Math.min(amount, arr.length) },\n\t\t\t(): K => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]!,\n\t\t);\n\t}\n\n\t/**\n\t * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse | Array.reverse()}\n\t * but returns a Collection instead of an Array.\n\t */\n\tpublic reverse() {\n\t\tconst entries = [...this.entries()].reverse();\n\t\tthis.clear();\n\t\tfor (const [key, value] of entries) this.set(key, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Searches for a single item where the given function returns a truthy value. This behaves like\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find | Array.find()}.\n\t * All collections used in Discord.js are mapped using their `id` property, and if you want to find by id you\n\t * should use the `get` method. See\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get | MDN} for details.\n\t *\n\t * @param fn - The function to test with (should return boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.find(user => user.username === 'Bob');\n\t * ```\n\t */\n\tpublic find(fn: (value: V, key: K, collection: this) => value is V2): V2 | undefined;\n\tpublic find(fn: (value: V, key: K, collection: this) => unknown): V | undefined;\n\tpublic find(\n\t\tfn: (this: This, value: V, key: K, collection: this) => value is V2,\n\t\tthisArg: This,\n\t): V2 | undefined;\n\tpublic find(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): V | undefined;\n\tpublic find(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): V | undefined {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) return val;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Searches for the key of a single item where the given function returns a truthy value. This behaves like\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex | Array.findIndex()},\n\t * but returns the key rather than the positional index.\n\t *\n\t * @param fn - The function to test with (should return boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.findKey(user => user.username === 'Bob');\n\t * ```\n\t */\n\tpublic findKey(fn: (value: V, key: K, collection: this) => key is K2): K2 | undefined;\n\tpublic findKey(fn: (value: V, key: K, collection: this) => unknown): K | undefined;\n\tpublic findKey(\n\t\tfn: (this: This, value: V, key: K, collection: this) => key is K2,\n\t\tthisArg: This,\n\t): K2 | undefined;\n\tpublic findKey(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): K | undefined;\n\tpublic findKey(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): K | undefined {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) return key;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Removes items that satisfy the provided filter function.\n\t *\n\t * @param fn - Function used to test (should return a boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @returns The number of removed entries\n\t */\n\tpublic sweep(fn: (value: V, key: K, collection: this) => unknown): number;\n\tpublic sweep(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): number;\n\tpublic sweep(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): number {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst previousSize = this.size;\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) this.delete(key);\n\t\t}\n\n\t\treturn previousSize - this.size;\n\t}\n\n\t/**\n\t * Identical to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter | Array.filter()},\n\t * but returns a Collection instead of an Array.\n\t *\n\t * @param fn - The function to test with (should return boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.filter(user => user.username === 'Bob');\n\t * ```\n\t */\n\tpublic filter(fn: (value: V, key: K, collection: this) => key is K2): Collection;\n\tpublic filter(fn: (value: V, key: K, collection: this) => value is V2): Collection;\n\tpublic filter(fn: (value: V, key: K, collection: this) => unknown): Collection;\n\tpublic filter(\n\t\tfn: (this: This, value: V, key: K, collection: this) => key is K2,\n\t\tthisArg: This,\n\t): Collection;\n\tpublic filter(\n\t\tfn: (this: This, value: V, key: K, collection: this) => value is V2,\n\t\tthisArg: This,\n\t): Collection;\n\tpublic filter(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): Collection;\n\tpublic filter(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): Collection {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst results = new this.constructor[Symbol.species]();\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) results.set(key, val);\n\t\t}\n\n\t\treturn results;\n\t}\n\n\t/**\n\t * Partitions the collection into two collections where the first collection\n\t * contains the items that passed and the second contains the items that failed.\n\t *\n\t * @param fn - Function used to test (should return a boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * const [big, small] = collection.partition(guild => guild.memberCount > 250);\n\t * ```\n\t */\n\tpublic partition(\n\t\tfn: (value: V, key: K, collection: this) => key is K2,\n\t): [Collection, Collection, V>];\n\tpublic partition(\n\t\tfn: (value: V, key: K, collection: this) => value is V2,\n\t): [Collection, Collection>];\n\tpublic partition(fn: (value: V, key: K, collection: this) => unknown): [Collection, Collection];\n\tpublic partition(\n\t\tfn: (this: This, value: V, key: K, collection: this) => key is K2,\n\t\tthisArg: This,\n\t): [Collection, Collection, V>];\n\tpublic partition(\n\t\tfn: (this: This, value: V, key: K, collection: this) => value is V2,\n\t\tthisArg: This,\n\t): [Collection, Collection>];\n\tpublic partition(\n\t\tfn: (this: This, value: V, key: K, collection: this) => unknown,\n\t\tthisArg: This,\n\t): [Collection, Collection];\n\tpublic partition(\n\t\tfn: (value: V, key: K, collection: this) => unknown,\n\t\tthisArg?: unknown,\n\t): [Collection, Collection] {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst results: [Collection, Collection] = [\n\t\t\tnew this.constructor[Symbol.species](),\n\t\t\tnew this.constructor[Symbol.species](),\n\t\t];\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) {\n\t\t\t\tresults[0].set(key, val);\n\t\t\t} else {\n\t\t\t\tresults[1].set(key, val);\n\t\t\t}\n\t\t}\n\n\t\treturn results;\n\t}\n\n\t/**\n\t * Maps each item into a Collection, then joins the results into a single Collection. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap | Array.flatMap()}.\n\t *\n\t * @param fn - Function that produces a new Collection\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.flatMap(guild => guild.members.cache);\n\t * ```\n\t */\n\tpublic flatMap(fn: (value: V, key: K, collection: this) => Collection): Collection;\n\tpublic flatMap(\n\t\tfn: (this: This, value: V, key: K, collection: this) => Collection,\n\t\tthisArg: This,\n\t): Collection;\n\tpublic flatMap(fn: (value: V, key: K, collection: this) => Collection, thisArg?: unknown): Collection {\n\t\t// eslint-disable-next-line unicorn/no-array-method-this-argument\n\t\tconst collections = this.map(fn, thisArg);\n\t\treturn new this.constructor[Symbol.species]().concat(...collections);\n\t}\n\n\t/**\n\t * Maps each item to another value into an array. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}.\n\t *\n\t * @param fn - Function that produces an element of the new array, taking three arguments\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.map(user => user.tag);\n\t * ```\n\t */\n\tpublic map(fn: (value: V, key: K, collection: this) => T): T[];\n\tpublic map(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): T[];\n\tpublic map(fn: (value: V, key: K, collection: this) => T, thisArg?: unknown): T[] {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst iter = this.entries();\n\t\treturn Array.from({ length: this.size }, (): T => {\n\t\t\tconst [key, value] = iter.next().value;\n\t\t\treturn fn(value, key, this);\n\t\t});\n\t}\n\n\t/**\n\t * Maps each item to another value into a collection. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}.\n\t *\n\t * @param fn - Function that produces an element of the new collection, taking three arguments\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.mapValues(user => user.tag);\n\t * ```\n\t */\n\tpublic mapValues(fn: (value: V, key: K, collection: this) => T): Collection;\n\tpublic mapValues(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): Collection;\n\tpublic mapValues(fn: (value: V, key: K, collection: this) => T, thisArg?: unknown): Collection {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tfor (const [key, val] of this) coll.set(key, fn(val, key, this));\n\t\treturn coll;\n\t}\n\n\t/**\n\t * Checks if there exists an item that passes a test. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some | Array.some()}.\n\t *\n\t * @param fn - Function used to test (should return a boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.some(user => user.discriminator === '0000');\n\t * ```\n\t */\n\tpublic some(fn: (value: V, key: K, collection: this) => unknown): boolean;\n\tpublic some(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): boolean;\n\tpublic some(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): boolean {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) return true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Checks if all items passes a test. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every | Array.every()}.\n\t *\n\t * @param fn - Function used to test (should return a boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.every(user => !user.bot);\n\t * ```\n\t */\n\tpublic every(fn: (value: V, key: K, collection: this) => key is K2): this is Collection;\n\tpublic every(fn: (value: V, key: K, collection: this) => value is V2): this is Collection;\n\tpublic every(fn: (value: V, key: K, collection: this) => unknown): boolean;\n\tpublic every(\n\t\tfn: (this: This, value: V, key: K, collection: this) => key is K2,\n\t\tthisArg: This,\n\t): this is Collection;\n\tpublic every(\n\t\tfn: (this: This, value: V, key: K, collection: this) => value is V2,\n\t\tthisArg: This,\n\t): this is Collection;\n\tpublic every(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): boolean;\n\tpublic every(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): boolean {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfor (const [key, val] of this) {\n\t\t\tif (!fn(val, key, this)) return false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Applies a function to produce a single value. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce | Array.reduce()}.\n\t *\n\t * @param fn - Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`,\n\t * and `collection`\n\t * @param initialValue - Starting value for the accumulator\n\t * @example\n\t * ```ts\n\t * collection.reduce((acc, guild) => acc + guild.memberCount, 0);\n\t * ```\n\t */\n\tpublic reduce(fn: (accumulator: T, value: V, key: K, collection: this) => T, initialValue?: T): T {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tlet accumulator!: T;\n\n\t\tconst iterator = this.entries();\n\t\tif (initialValue === undefined) {\n\t\t\tif (this.size === 0) throw new TypeError('Reduce of empty collection with no initial value');\n\t\t\taccumulator = iterator.next().value[1];\n\t\t} else {\n\t\t\taccumulator = initialValue;\n\t\t}\n\n\t\tfor (const [key, value] of iterator) {\n\t\t\taccumulator = fn(accumulator, value, key, this);\n\t\t}\n\n\t\treturn accumulator;\n\t}\n\n\t/**\n\t * Identical to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach | Map.forEach()},\n\t * but returns the collection instead of undefined.\n\t *\n\t * @param fn - Function to execute for each element\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection\n\t * .each(user => console.log(user.username))\n\t * .filter(user => user.bot)\n\t * .each(user => console.log(user.username));\n\t * ```\n\t */\n\tpublic each(fn: (value: V, key: K, collection: this) => void): this;\n\tpublic each(fn: (this: T, value: V, key: K, collection: this) => void, thisArg: T): this;\n\tpublic each(fn: (value: V, key: K, collection: this) => void, thisArg?: unknown): this {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\n\t\tfor (const [key, value] of this) {\n\t\t\tfn(value, key, this);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Runs a function on the collection and returns the collection.\n\t *\n\t * @param fn - Function to execute\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection\n\t * .tap(coll => console.log(coll.size))\n\t * .filter(user => user.bot)\n\t * .tap(coll => console.log(coll.size))\n\t * ```\n\t */\n\tpublic tap(fn: (collection: this) => void): this;\n\tpublic tap(fn: (this: T, collection: this) => void, thisArg: T): this;\n\tpublic tap(fn: (collection: this) => void, thisArg?: unknown): this {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfn(this);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates an identical shallow copy of this collection.\n\t *\n\t * @example\n\t * ```ts\n\t * const newColl = someColl.clone();\n\t * ```\n\t */\n\tpublic clone(): Collection {\n\t\treturn new this.constructor[Symbol.species](this);\n\t}\n\n\t/**\n\t * Combines this collection with others into a new collection. None of the source collections are modified.\n\t *\n\t * @param collections - Collections to merge\n\t * @example\n\t * ```ts\n\t * const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);\n\t * ```\n\t */\n\tpublic concat(...collections: ReadonlyCollection[]) {\n\t\tconst newColl = this.clone();\n\t\tfor (const coll of collections) {\n\t\t\tfor (const [key, val] of coll) newColl.set(key, val);\n\t\t}\n\n\t\treturn newColl;\n\t}\n\n\t/**\n\t * Checks if this collection shares identical items with another.\n\t * This is different to checking for equality using equal-signs, because\n\t * the collections may be different objects, but contain the same data.\n\t *\n\t * @param collection - Collection to compare with\n\t * @returns Whether the collections have identical contents\n\t */\n\tpublic equals(collection: ReadonlyCollection) {\n\t\tif (!collection) return false; // runtime check\n\t\tif (this === collection) return true;\n\t\tif (this.size !== collection.size) return false;\n\t\tfor (const [key, value] of this) {\n\t\t\tif (!collection.has(key) || value !== collection.get(key)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * The sort method sorts the items of a collection in place and returns it.\n\t * The sort is not necessarily stable in Node 10 or older.\n\t * The default sort order is according to string Unicode code points.\n\t *\n\t * @param compareFunction - Specifies a function that defines the sort order.\n\t * If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.\n\t * @example\n\t * ```ts\n\t * collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);\n\t * ```\n\t */\n\tpublic sort(compareFunction: Comparator = Collection.defaultSort) {\n\t\tconst entries = [...this.entries()];\n\t\tentries.sort((a, b): number => compareFunction(a[1], b[1], a[0], b[0]));\n\n\t\t// Perform clean-up\n\t\tsuper.clear();\n\n\t\t// Set the new entries\n\t\tfor (const [key, value] of entries) {\n\t\t\tsuper.set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * The intersect method returns a new structure containing items where the keys and values are present in both original structures.\n\t *\n\t * @param other - The other Collection to filter against\n\t */\n\tpublic intersect(other: ReadonlyCollection): Collection {\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tfor (const [key, value] of other) {\n\t\t\tif (this.has(key) && Object.is(value, this.get(key))) {\n\t\t\t\tcoll.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\treturn coll;\n\t}\n\n\t/**\n\t * The subtract method returns a new structure containing items where the keys and values of the original structure are not present in the other.\n\t *\n\t * @param other - The other Collection to filter against\n\t */\n\tpublic subtract(other: ReadonlyCollection): Collection {\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tfor (const [key, value] of this) {\n\t\t\tif (!other.has(key) || !Object.is(value, other.get(key))) {\n\t\t\t\tcoll.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\treturn coll;\n\t}\n\n\t/**\n\t * The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.\n\t *\n\t * @param other - The other Collection to filter against\n\t */\n\tpublic difference(other: ReadonlyCollection): Collection {\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tfor (const [key, value] of other) {\n\t\t\tif (!this.has(key)) coll.set(key, value);\n\t\t}\n\n\t\tfor (const [key, value] of this) {\n\t\t\tif (!other.has(key)) coll.set(key, value);\n\t\t}\n\n\t\treturn coll;\n\t}\n\n\t/**\n\t * Merges two Collections together into a new Collection.\n\t *\n\t * @param other - The other Collection to merge with\n\t * @param whenInSelf - Function getting the result if the entry only exists in this Collection\n\t * @param whenInOther - Function getting the result if the entry only exists in the other Collection\n\t * @param whenInBoth - Function getting the result if the entry exists in both Collections\n\t * @example\n\t * ```ts\n\t * // Sums up the entries in two collections.\n\t * coll.merge(\n\t * other,\n\t * x => ({ keep: true, value: x }),\n\t * y => ({ keep: true, value: y }),\n\t * (x, y) => ({ keep: true, value: x + y }),\n\t * );\n\t * ```\n\t * @example\n\t * ```ts\n\t * // Intersects two collections in a left-biased manner.\n\t * coll.merge(\n\t * other,\n\t * x => ({ keep: false }),\n\t * y => ({ keep: false }),\n\t * (x, _) => ({ keep: true, value: x }),\n\t * );\n\t * ```\n\t */\n\tpublic merge(\n\t\tother: ReadonlyCollection,\n\t\twhenInSelf: (value: V, key: K) => Keep,\n\t\twhenInOther: (valueOther: T, key: K) => Keep,\n\t\twhenInBoth: (value: V, valueOther: T, key: K) => Keep,\n\t): Collection {\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tconst keys = new Set([...this.keys(), ...other.keys()]);\n\n\t\tfor (const key of keys) {\n\t\t\tconst hasInSelf = this.has(key);\n\t\t\tconst hasInOther = other.has(key);\n\n\t\t\tif (hasInSelf && hasInOther) {\n\t\t\t\tconst result = whenInBoth(this.get(key)!, other.get(key)!, key);\n\t\t\t\tif (result.keep) coll.set(key, result.value);\n\t\t\t} else if (hasInSelf) {\n\t\t\t\tconst result = whenInSelf(this.get(key)!, key);\n\t\t\t\tif (result.keep) coll.set(key, result.value);\n\t\t\t} else if (hasInOther) {\n\t\t\t\tconst result = whenInOther(other.get(key)!, key);\n\t\t\t\tif (result.keep) coll.set(key, result.value);\n\t\t\t}\n\t\t}\n\n\t\treturn coll;\n\t}\n\n\t/**\n\t * The sorted method sorts the items of a collection and returns it.\n\t * The sort is not necessarily stable in Node 10 or older.\n\t * The default sort order is according to string Unicode code points.\n\t *\n\t * @param compareFunction - Specifies a function that defines the sort order.\n\t * If omitted, the collection is sorted according to each character's Unicode code point value,\n\t * according to the string conversion of each element.\n\t * @example\n\t * ```ts\n\t * collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);\n\t * ```\n\t */\n\tpublic sorted(compareFunction: Comparator = Collection.defaultSort) {\n\t\treturn new this.constructor[Symbol.species](this).sort((av, bv, ak, bk) => compareFunction(av, bv, ak, bk));\n\t}\n\n\tpublic toJSON() {\n\t\t// toJSON is called recursively by JSON.stringify.\n\t\treturn [...this.values()];\n\t}\n\n\tprivate static defaultSort(firstValue: V, secondValue: V): number {\n\t\treturn Number(firstValue > secondValue) || Number(firstValue === secondValue) - 1;\n\t}\n\n\t/**\n\t * Creates a Collection from a list of entries.\n\t *\n\t * @param entries - The list of entries\n\t * @param combine - Function to combine an existing entry with a new one\n\t * @example\n\t * ```ts\n\t * Collection.combineEntries([[\"a\", 1], [\"b\", 2], [\"a\", 2]], (x, y) => x + y);\n\t * // returns Collection { \"a\" => 3, \"b\" => 2 }\n\t * ```\n\t */\n\tpublic static combineEntries(\n\t\tentries: Iterable<[K, V]>,\n\t\tcombine: (firstValue: V, secondValue: V, key: K) => V,\n\t): Collection {\n\t\tconst coll = new Collection();\n\t\tfor (const [key, value] of entries) {\n\t\t\tif (coll.has(key)) {\n\t\t\t\tcoll.set(key, combine(coll.get(key)!, value, key));\n\t\t\t} else {\n\t\t\t\tcoll.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\treturn coll;\n\t}\n}\n\n/**\n * @internal\n */\nexport type Keep = { keep: false } | { keep: true; value: V };\n\n/**\n * @internal\n */\nexport type Comparator = (firstValue: V, secondValue: V, firstKey: K, secondKey: K) => number;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqCO,IAAM,aAAN,MAAM,oBAAyB,IAAU;AAAA,EArChD,OAqCgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWxC,OAAO,KAAQ,uBAA2D;AAChF,QAAI,KAAK,IAAI,GAAG;AAAG,aAAO,KAAK,IAAI,GAAG;AACtC,QAAI,OAAO,0BAA0B;AAAY,YAAM,IAAI,UAAU,GAAG,qBAAqB,oBAAoB;AACjH,UAAM,eAAe,sBAAsB,KAAK,IAAI;AACpD,SAAK,IAAI,KAAK,YAAY;AAC1B,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,UAAU,MAAW;AAC3B,WAAO,KAAK,MAAM,CAAC,QAAQ,MAAM,IAAI,GAAG,CAAC;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,UAAU,MAAW;AAC3B,WAAO,KAAK,KAAK,CAAC,QAAQ,MAAM,IAAI,GAAG,CAAC;AAAA,EACzC;AAAA,EAUO,MAAM,QAAsC;AAClD,QAAI,WAAW;AAAW,aAAO,KAAK,OAAO,EAAE,KAAK,EAAE;AACtD,QAAI,SAAS;AAAG,aAAO,KAAK,KAAK,SAAS,EAAE;AAC5C,aAAS,KAAK,IAAI,KAAK,MAAM,MAAM;AACnC,UAAM,OAAO,KAAK,OAAO;AACzB,WAAO,MAAM,KAAK,EAAE,QAAQ,OAAO,GAAG,MAAS,KAAK,KAAK,EAAE,KAAK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e,YAAe,aAAwB;AACpE,WAAO,OAAO,aAAa,WAAW,KAAK,OAAO,eAAe,WAAW,IAAI;AAAA,EACjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,OAAc,eACb,SACA,SACmB;AACnB,UAAM,OAAO,IAAI,YAAiB;AAClC,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AACnC,UAAI,KAAK,IAAI,GAAG,GAAG;AAClB,aAAK,IAAI,KAAK,QAAQ,KAAK,IAAI,GAAG,GAAI,OAAO,GAAG,CAAC;AAAA,MAClD,OAAO;AACN,aAAK,IAAI,KAAK,KAAK;AAAA,MACpB;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AACD;;;AD9yBO,IAAM,UAAU;","names":[]} \ No newline at end of file diff --git a/node_modules/@discordjs/collection/dist/index.mjs b/node_modules/@discordjs/collection/dist/index.mjs new file mode 100644 index 0000000..c31c9ee --- /dev/null +++ b/node_modules/@discordjs/collection/dist/index.mjs @@ -0,0 +1,517 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/collection.ts +var Collection = class _Collection extends Map { + static { + __name(this, "Collection"); + } + /** + * Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator. + * + * @param key - The key to get if it exists, or set otherwise + * @param defaultValueGenerator - A function that generates the default value + * @example + * ```ts + * collection.ensure(guildId, () => defaultGuildConfig); + * ``` + */ + ensure(key, defaultValueGenerator) { + if (this.has(key)) + return this.get(key); + if (typeof defaultValueGenerator !== "function") + throw new TypeError(`${defaultValueGenerator} is not a function`); + const defaultValue = defaultValueGenerator(key, this); + this.set(key, defaultValue); + return defaultValue; + } + /** + * Checks if all of the elements exist in the collection. + * + * @param keys - The keys of the elements to check for + * @returns `true` if all of the elements exist, `false` if at least one does not exist. + */ + hasAll(...keys) { + return keys.every((key) => super.has(key)); + } + /** + * Checks if any of the elements exist in the collection. + * + * @param keys - The keys of the elements to check for + * @returns `true` if any of the elements exist, `false` if none exist. + */ + hasAny(...keys) { + return keys.some((key) => super.has(key)); + } + first(amount) { + if (amount === void 0) + return this.values().next().value; + if (amount < 0) + return this.last(amount * -1); + amount = Math.min(this.size, amount); + const iter = this.values(); + return Array.from({ length: amount }, () => iter.next().value); + } + firstKey(amount) { + if (amount === void 0) + return this.keys().next().value; + if (amount < 0) + return this.lastKey(amount * -1); + amount = Math.min(this.size, amount); + const iter = this.keys(); + return Array.from({ length: amount }, () => iter.next().value); + } + last(amount) { + const arr = [...this.values()]; + if (amount === void 0) + return arr[arr.length - 1]; + if (amount < 0) + return this.first(amount * -1); + if (!amount) + return []; + return arr.slice(-amount); + } + lastKey(amount) { + const arr = [...this.keys()]; + if (amount === void 0) + return arr[arr.length - 1]; + if (amount < 0) + return this.firstKey(amount * -1); + if (!amount) + return []; + return arr.slice(-amount); + } + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}. + * Returns the item at a given index, allowing for positive and negative integers. + * Negative integers count back from the last item in the collection. + * + * @param index - The index of the element to obtain + */ + at(index) { + index = Math.floor(index); + const arr = [...this.values()]; + return arr.at(index); + } + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}. + * Returns the key at a given index, allowing for positive and negative integers. + * Negative integers count back from the last item in the collection. + * + * @param index - The index of the key to obtain + */ + keyAt(index) { + index = Math.floor(index); + const arr = [...this.keys()]; + return arr.at(index); + } + random(amount) { + const arr = [...this.values()]; + if (amount === void 0) + return arr[Math.floor(Math.random() * arr.length)]; + if (!arr.length || !amount) + return []; + return Array.from( + { length: Math.min(amount, arr.length) }, + () => arr.splice(Math.floor(Math.random() * arr.length), 1)[0] + ); + } + randomKey(amount) { + const arr = [...this.keys()]; + if (amount === void 0) + return arr[Math.floor(Math.random() * arr.length)]; + if (!arr.length || !amount) + return []; + return Array.from( + { length: Math.min(amount, arr.length) }, + () => arr.splice(Math.floor(Math.random() * arr.length), 1)[0] + ); + } + /** + * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse | Array.reverse()} + * but returns a Collection instead of an Array. + */ + reverse() { + const entries = [...this.entries()].reverse(); + this.clear(); + for (const [key, value] of entries) + this.set(key, value); + return this; + } + find(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (fn(val, key, this)) + return val; + } + return void 0; + } + findKey(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (fn(val, key, this)) + return key; + } + return void 0; + } + sweep(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const previousSize = this.size; + for (const [key, val] of this) { + if (fn(val, key, this)) + this.delete(key); + } + return previousSize - this.size; + } + filter(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const results = new this.constructor[Symbol.species](); + for (const [key, val] of this) { + if (fn(val, key, this)) + results.set(key, val); + } + return results; + } + partition(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const results = [ + new this.constructor[Symbol.species](), + new this.constructor[Symbol.species]() + ]; + for (const [key, val] of this) { + if (fn(val, key, this)) { + results[0].set(key, val); + } else { + results[1].set(key, val); + } + } + return results; + } + flatMap(fn, thisArg) { + const collections = this.map(fn, thisArg); + return new this.constructor[Symbol.species]().concat(...collections); + } + map(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const iter = this.entries(); + return Array.from({ length: this.size }, () => { + const [key, value] = iter.next().value; + return fn(value, key, this); + }); + } + mapValues(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + const coll = new this.constructor[Symbol.species](); + for (const [key, val] of this) + coll.set(key, fn(val, key, this)); + return coll; + } + some(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (fn(val, key, this)) + return true; + } + return false; + } + every(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (!fn(val, key, this)) + return false; + } + return true; + } + /** + * Applies a function to produce a single value. Identical in behavior to + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce | Array.reduce()}. + * + * @param fn - Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`, + * and `collection` + * @param initialValue - Starting value for the accumulator + * @example + * ```ts + * collection.reduce((acc, guild) => acc + guild.memberCount, 0); + * ``` + */ + reduce(fn, initialValue) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + let accumulator; + const iterator = this.entries(); + if (initialValue === void 0) { + if (this.size === 0) + throw new TypeError("Reduce of empty collection with no initial value"); + accumulator = iterator.next().value[1]; + } else { + accumulator = initialValue; + } + for (const [key, value] of iterator) { + accumulator = fn(accumulator, value, key, this); + } + return accumulator; + } + each(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + for (const [key, value] of this) { + fn(value, key, this); + } + return this; + } + tap(fn, thisArg) { + if (typeof fn !== "function") + throw new TypeError(`${fn} is not a function`); + if (thisArg !== void 0) + fn = fn.bind(thisArg); + fn(this); + return this; + } + /** + * Creates an identical shallow copy of this collection. + * + * @example + * ```ts + * const newColl = someColl.clone(); + * ``` + */ + clone() { + return new this.constructor[Symbol.species](this); + } + /** + * Combines this collection with others into a new collection. None of the source collections are modified. + * + * @param collections - Collections to merge + * @example + * ```ts + * const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl); + * ``` + */ + concat(...collections) { + const newColl = this.clone(); + for (const coll of collections) { + for (const [key, val] of coll) + newColl.set(key, val); + } + return newColl; + } + /** + * Checks if this collection shares identical items with another. + * This is different to checking for equality using equal-signs, because + * the collections may be different objects, but contain the same data. + * + * @param collection - Collection to compare with + * @returns Whether the collections have identical contents + */ + equals(collection) { + if (!collection) + return false; + if (this === collection) + return true; + if (this.size !== collection.size) + return false; + for (const [key, value] of this) { + if (!collection.has(key) || value !== collection.get(key)) { + return false; + } + } + return true; + } + /** + * The sort method sorts the items of a collection in place and returns it. + * The sort is not necessarily stable in Node 10 or older. + * The default sort order is according to string Unicode code points. + * + * @param compareFunction - Specifies a function that defines the sort order. + * If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element. + * @example + * ```ts + * collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp); + * ``` + */ + sort(compareFunction = _Collection.defaultSort) { + const entries = [...this.entries()]; + entries.sort((a, b) => compareFunction(a[1], b[1], a[0], b[0])); + super.clear(); + for (const [key, value] of entries) { + super.set(key, value); + } + return this; + } + /** + * The intersect method returns a new structure containing items where the keys and values are present in both original structures. + * + * @param other - The other Collection to filter against + */ + intersect(other) { + const coll = new this.constructor[Symbol.species](); + for (const [key, value] of other) { + if (this.has(key) && Object.is(value, this.get(key))) { + coll.set(key, value); + } + } + return coll; + } + /** + * The subtract method returns a new structure containing items where the keys and values of the original structure are not present in the other. + * + * @param other - The other Collection to filter against + */ + subtract(other) { + const coll = new this.constructor[Symbol.species](); + for (const [key, value] of this) { + if (!other.has(key) || !Object.is(value, other.get(key))) { + coll.set(key, value); + } + } + return coll; + } + /** + * The difference method returns a new structure containing items where the key is present in one of the original structures but not the other. + * + * @param other - The other Collection to filter against + */ + difference(other) { + const coll = new this.constructor[Symbol.species](); + for (const [key, value] of other) { + if (!this.has(key)) + coll.set(key, value); + } + for (const [key, value] of this) { + if (!other.has(key)) + coll.set(key, value); + } + return coll; + } + /** + * Merges two Collections together into a new Collection. + * + * @param other - The other Collection to merge with + * @param whenInSelf - Function getting the result if the entry only exists in this Collection + * @param whenInOther - Function getting the result if the entry only exists in the other Collection + * @param whenInBoth - Function getting the result if the entry exists in both Collections + * @example + * ```ts + * // Sums up the entries in two collections. + * coll.merge( + * other, + * x => ({ keep: true, value: x }), + * y => ({ keep: true, value: y }), + * (x, y) => ({ keep: true, value: x + y }), + * ); + * ``` + * @example + * ```ts + * // Intersects two collections in a left-biased manner. + * coll.merge( + * other, + * x => ({ keep: false }), + * y => ({ keep: false }), + * (x, _) => ({ keep: true, value: x }), + * ); + * ``` + */ + merge(other, whenInSelf, whenInOther, whenInBoth) { + const coll = new this.constructor[Symbol.species](); + const keys = /* @__PURE__ */ new Set([...this.keys(), ...other.keys()]); + for (const key of keys) { + const hasInSelf = this.has(key); + const hasInOther = other.has(key); + if (hasInSelf && hasInOther) { + const result = whenInBoth(this.get(key), other.get(key), key); + if (result.keep) + coll.set(key, result.value); + } else if (hasInSelf) { + const result = whenInSelf(this.get(key), key); + if (result.keep) + coll.set(key, result.value); + } else if (hasInOther) { + const result = whenInOther(other.get(key), key); + if (result.keep) + coll.set(key, result.value); + } + } + return coll; + } + /** + * The sorted method sorts the items of a collection and returns it. + * The sort is not necessarily stable in Node 10 or older. + * The default sort order is according to string Unicode code points. + * + * @param compareFunction - Specifies a function that defines the sort order. + * If omitted, the collection is sorted according to each character's Unicode code point value, + * according to the string conversion of each element. + * @example + * ```ts + * collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp); + * ``` + */ + sorted(compareFunction = _Collection.defaultSort) { + return new this.constructor[Symbol.species](this).sort((av, bv, ak, bk) => compareFunction(av, bv, ak, bk)); + } + toJSON() { + return [...this.values()]; + } + static defaultSort(firstValue, secondValue) { + return Number(firstValue > secondValue) || Number(firstValue === secondValue) - 1; + } + /** + * Creates a Collection from a list of entries. + * + * @param entries - The list of entries + * @param combine - Function to combine an existing entry with a new one + * @example + * ```ts + * Collection.combineEntries([["a", 1], ["b", 2], ["a", 2]], (x, y) => x + y); + * // returns Collection { "a" => 3, "b" => 2 } + * ``` + */ + static combineEntries(entries, combine) { + const coll = new _Collection(); + for (const [key, value] of entries) { + if (coll.has(key)) { + coll.set(key, combine(coll.get(key), value, key)); + } else { + coll.set(key, value); + } + } + return coll; + } +}; + +// src/index.ts +var version = "1.5.3"; +export { + Collection, + version +}; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/node_modules/@discordjs/collection/dist/index.mjs.map b/node_modules/@discordjs/collection/dist/index.mjs.map new file mode 100644 index 0000000..fcf72ab --- /dev/null +++ b/node_modules/@discordjs/collection/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/collection.ts","../src/index.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\n/**\n * @internal\n */\nexport interface CollectionConstructor {\n\tnew (): Collection;\n\tnew (entries?: readonly (readonly [K, V])[] | null): Collection;\n\tnew (iterable: Iterable): Collection;\n\treadonly prototype: Collection;\n\treadonly [Symbol.species]: CollectionConstructor;\n}\n\n/**\n * Represents an immutable version of a collection\n */\nexport type ReadonlyCollection = Omit<\n\tCollection,\n\t'delete' | 'ensure' | 'forEach' | 'get' | 'reverse' | 'set' | 'sort' | 'sweep'\n> &\n\tReadonlyMap;\n\n/**\n * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself\n *\n * @internal\n */\nexport interface Collection extends Map {\n\tconstructor: CollectionConstructor;\n}\n\n/**\n * A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has\n * an ID, for significantly improved performance and ease-of-use.\n *\n * @typeParam K - The key type this collection holds\n * @typeParam V - The value type this collection holds\n */\nexport class Collection extends Map {\n\t/**\n\t * Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator.\n\t *\n\t * @param key - The key to get if it exists, or set otherwise\n\t * @param defaultValueGenerator - A function that generates the default value\n\t * @example\n\t * ```ts\n\t * collection.ensure(guildId, () => defaultGuildConfig);\n\t * ```\n\t */\n\tpublic ensure(key: K, defaultValueGenerator: (key: K, collection: this) => V): V {\n\t\tif (this.has(key)) return this.get(key)!;\n\t\tif (typeof defaultValueGenerator !== 'function') throw new TypeError(`${defaultValueGenerator} is not a function`);\n\t\tconst defaultValue = defaultValueGenerator(key, this);\n\t\tthis.set(key, defaultValue);\n\t\treturn defaultValue;\n\t}\n\n\t/**\n\t * Checks if all of the elements exist in the collection.\n\t *\n\t * @param keys - The keys of the elements to check for\n\t * @returns `true` if all of the elements exist, `false` if at least one does not exist.\n\t */\n\tpublic hasAll(...keys: K[]) {\n\t\treturn keys.every((key) => super.has(key));\n\t}\n\n\t/**\n\t * Checks if any of the elements exist in the collection.\n\t *\n\t * @param keys - The keys of the elements to check for\n\t * @returns `true` if any of the elements exist, `false` if none exist.\n\t */\n\tpublic hasAny(...keys: K[]) {\n\t\treturn keys.some((key) => super.has(key));\n\t}\n\n\t/**\n\t * Obtains the first value(s) in this collection.\n\t *\n\t * @param amount - Amount of values to obtain from the beginning\n\t * @returns A single value if no amount is provided or an array of values, starting from the end if amount is negative\n\t */\n\tpublic first(): V | undefined;\n\tpublic first(amount: number): V[];\n\tpublic first(amount?: number): V | V[] | undefined {\n\t\tif (amount === undefined) return this.values().next().value;\n\t\tif (amount < 0) return this.last(amount * -1);\n\t\tamount = Math.min(this.size, amount);\n\t\tconst iter = this.values();\n\t\treturn Array.from({ length: amount }, (): V => iter.next().value);\n\t}\n\n\t/**\n\t * Obtains the first key(s) in this collection.\n\t *\n\t * @param amount - Amount of keys to obtain from the beginning\n\t * @returns A single key if no amount is provided or an array of keys, starting from the end if\n\t * amount is negative\n\t */\n\tpublic firstKey(): K | undefined;\n\tpublic firstKey(amount: number): K[];\n\tpublic firstKey(amount?: number): K | K[] | undefined {\n\t\tif (amount === undefined) return this.keys().next().value;\n\t\tif (amount < 0) return this.lastKey(amount * -1);\n\t\tamount = Math.min(this.size, amount);\n\t\tconst iter = this.keys();\n\t\treturn Array.from({ length: amount }, (): K => iter.next().value);\n\t}\n\n\t/**\n\t * Obtains the last value(s) in this collection.\n\t *\n\t * @param amount - Amount of values to obtain from the end\n\t * @returns A single value if no amount is provided or an array of values, starting from the start if\n\t * amount is negative\n\t */\n\tpublic last(): V | undefined;\n\tpublic last(amount: number): V[];\n\tpublic last(amount?: number): V | V[] | undefined {\n\t\tconst arr = [...this.values()];\n\t\tif (amount === undefined) return arr[arr.length - 1];\n\t\tif (amount < 0) return this.first(amount * -1);\n\t\tif (!amount) return [];\n\t\treturn arr.slice(-amount);\n\t}\n\n\t/**\n\t * Obtains the last key(s) in this collection.\n\t *\n\t * @param amount - Amount of keys to obtain from the end\n\t * @returns A single key if no amount is provided or an array of keys, starting from the start if\n\t * amount is negative\n\t */\n\tpublic lastKey(): K | undefined;\n\tpublic lastKey(amount: number): K[];\n\tpublic lastKey(amount?: number): K | K[] | undefined {\n\t\tconst arr = [...this.keys()];\n\t\tif (amount === undefined) return arr[arr.length - 1];\n\t\tif (amount < 0) return this.firstKey(amount * -1);\n\t\tif (!amount) return [];\n\t\treturn arr.slice(-amount);\n\t}\n\n\t/**\n\t * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}.\n\t * Returns the item at a given index, allowing for positive and negative integers.\n\t * Negative integers count back from the last item in the collection.\n\t *\n\t * @param index - The index of the element to obtain\n\t */\n\tpublic at(index: number) {\n\t\tindex = Math.floor(index);\n\t\tconst arr = [...this.values()];\n\t\treturn arr.at(index);\n\t}\n\n\t/**\n\t * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at()}.\n\t * Returns the key at a given index, allowing for positive and negative integers.\n\t * Negative integers count back from the last item in the collection.\n\t *\n\t * @param index - The index of the key to obtain\n\t */\n\tpublic keyAt(index: number) {\n\t\tindex = Math.floor(index);\n\t\tconst arr = [...this.keys()];\n\t\treturn arr.at(index);\n\t}\n\n\t/**\n\t * Obtains unique random value(s) from this collection.\n\t *\n\t * @param amount - Amount of values to obtain randomly\n\t * @returns A single value if no amount is provided or an array of values\n\t */\n\tpublic random(): V | undefined;\n\tpublic random(amount: number): V[];\n\tpublic random(amount?: number): V | V[] | undefined {\n\t\tconst arr = [...this.values()];\n\t\tif (amount === undefined) return arr[Math.floor(Math.random() * arr.length)];\n\t\tif (!arr.length || !amount) return [];\n\t\treturn Array.from(\n\t\t\t{ length: Math.min(amount, arr.length) },\n\t\t\t(): V => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]!,\n\t\t);\n\t}\n\n\t/**\n\t * Obtains unique random key(s) from this collection.\n\t *\n\t * @param amount - Amount of keys to obtain randomly\n\t * @returns A single key if no amount is provided or an array\n\t */\n\tpublic randomKey(): K | undefined;\n\tpublic randomKey(amount: number): K[];\n\tpublic randomKey(amount?: number): K | K[] | undefined {\n\t\tconst arr = [...this.keys()];\n\t\tif (amount === undefined) return arr[Math.floor(Math.random() * arr.length)];\n\t\tif (!arr.length || !amount) return [];\n\t\treturn Array.from(\n\t\t\t{ length: Math.min(amount, arr.length) },\n\t\t\t(): K => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]!,\n\t\t);\n\t}\n\n\t/**\n\t * Identical to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse | Array.reverse()}\n\t * but returns a Collection instead of an Array.\n\t */\n\tpublic reverse() {\n\t\tconst entries = [...this.entries()].reverse();\n\t\tthis.clear();\n\t\tfor (const [key, value] of entries) this.set(key, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Searches for a single item where the given function returns a truthy value. This behaves like\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find | Array.find()}.\n\t * All collections used in Discord.js are mapped using their `id` property, and if you want to find by id you\n\t * should use the `get` method. See\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get | MDN} for details.\n\t *\n\t * @param fn - The function to test with (should return boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.find(user => user.username === 'Bob');\n\t * ```\n\t */\n\tpublic find(fn: (value: V, key: K, collection: this) => value is V2): V2 | undefined;\n\tpublic find(fn: (value: V, key: K, collection: this) => unknown): V | undefined;\n\tpublic find(\n\t\tfn: (this: This, value: V, key: K, collection: this) => value is V2,\n\t\tthisArg: This,\n\t): V2 | undefined;\n\tpublic find(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): V | undefined;\n\tpublic find(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): V | undefined {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) return val;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Searches for the key of a single item where the given function returns a truthy value. This behaves like\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex | Array.findIndex()},\n\t * but returns the key rather than the positional index.\n\t *\n\t * @param fn - The function to test with (should return boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.findKey(user => user.username === 'Bob');\n\t * ```\n\t */\n\tpublic findKey(fn: (value: V, key: K, collection: this) => key is K2): K2 | undefined;\n\tpublic findKey(fn: (value: V, key: K, collection: this) => unknown): K | undefined;\n\tpublic findKey(\n\t\tfn: (this: This, value: V, key: K, collection: this) => key is K2,\n\t\tthisArg: This,\n\t): K2 | undefined;\n\tpublic findKey(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): K | undefined;\n\tpublic findKey(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): K | undefined {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) return key;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Removes items that satisfy the provided filter function.\n\t *\n\t * @param fn - Function used to test (should return a boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @returns The number of removed entries\n\t */\n\tpublic sweep(fn: (value: V, key: K, collection: this) => unknown): number;\n\tpublic sweep(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): number;\n\tpublic sweep(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): number {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst previousSize = this.size;\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) this.delete(key);\n\t\t}\n\n\t\treturn previousSize - this.size;\n\t}\n\n\t/**\n\t * Identical to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter | Array.filter()},\n\t * but returns a Collection instead of an Array.\n\t *\n\t * @param fn - The function to test with (should return boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.filter(user => user.username === 'Bob');\n\t * ```\n\t */\n\tpublic filter(fn: (value: V, key: K, collection: this) => key is K2): Collection;\n\tpublic filter(fn: (value: V, key: K, collection: this) => value is V2): Collection;\n\tpublic filter(fn: (value: V, key: K, collection: this) => unknown): Collection;\n\tpublic filter(\n\t\tfn: (this: This, value: V, key: K, collection: this) => key is K2,\n\t\tthisArg: This,\n\t): Collection;\n\tpublic filter(\n\t\tfn: (this: This, value: V, key: K, collection: this) => value is V2,\n\t\tthisArg: This,\n\t): Collection;\n\tpublic filter(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): Collection;\n\tpublic filter(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): Collection {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst results = new this.constructor[Symbol.species]();\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) results.set(key, val);\n\t\t}\n\n\t\treturn results;\n\t}\n\n\t/**\n\t * Partitions the collection into two collections where the first collection\n\t * contains the items that passed and the second contains the items that failed.\n\t *\n\t * @param fn - Function used to test (should return a boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * const [big, small] = collection.partition(guild => guild.memberCount > 250);\n\t * ```\n\t */\n\tpublic partition(\n\t\tfn: (value: V, key: K, collection: this) => key is K2,\n\t): [Collection, Collection, V>];\n\tpublic partition(\n\t\tfn: (value: V, key: K, collection: this) => value is V2,\n\t): [Collection, Collection>];\n\tpublic partition(fn: (value: V, key: K, collection: this) => unknown): [Collection, Collection];\n\tpublic partition(\n\t\tfn: (this: This, value: V, key: K, collection: this) => key is K2,\n\t\tthisArg: This,\n\t): [Collection, Collection, V>];\n\tpublic partition(\n\t\tfn: (this: This, value: V, key: K, collection: this) => value is V2,\n\t\tthisArg: This,\n\t): [Collection, Collection>];\n\tpublic partition(\n\t\tfn: (this: This, value: V, key: K, collection: this) => unknown,\n\t\tthisArg: This,\n\t): [Collection, Collection];\n\tpublic partition(\n\t\tfn: (value: V, key: K, collection: this) => unknown,\n\t\tthisArg?: unknown,\n\t): [Collection, Collection] {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst results: [Collection, Collection] = [\n\t\t\tnew this.constructor[Symbol.species](),\n\t\t\tnew this.constructor[Symbol.species](),\n\t\t];\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) {\n\t\t\t\tresults[0].set(key, val);\n\t\t\t} else {\n\t\t\t\tresults[1].set(key, val);\n\t\t\t}\n\t\t}\n\n\t\treturn results;\n\t}\n\n\t/**\n\t * Maps each item into a Collection, then joins the results into a single Collection. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap | Array.flatMap()}.\n\t *\n\t * @param fn - Function that produces a new Collection\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.flatMap(guild => guild.members.cache);\n\t * ```\n\t */\n\tpublic flatMap(fn: (value: V, key: K, collection: this) => Collection): Collection;\n\tpublic flatMap(\n\t\tfn: (this: This, value: V, key: K, collection: this) => Collection,\n\t\tthisArg: This,\n\t): Collection;\n\tpublic flatMap(fn: (value: V, key: K, collection: this) => Collection, thisArg?: unknown): Collection {\n\t\t// eslint-disable-next-line unicorn/no-array-method-this-argument\n\t\tconst collections = this.map(fn, thisArg);\n\t\treturn new this.constructor[Symbol.species]().concat(...collections);\n\t}\n\n\t/**\n\t * Maps each item to another value into an array. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}.\n\t *\n\t * @param fn - Function that produces an element of the new array, taking three arguments\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.map(user => user.tag);\n\t * ```\n\t */\n\tpublic map(fn: (value: V, key: K, collection: this) => T): T[];\n\tpublic map(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): T[];\n\tpublic map(fn: (value: V, key: K, collection: this) => T, thisArg?: unknown): T[] {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst iter = this.entries();\n\t\treturn Array.from({ length: this.size }, (): T => {\n\t\t\tconst [key, value] = iter.next().value;\n\t\t\treturn fn(value, key, this);\n\t\t});\n\t}\n\n\t/**\n\t * Maps each item to another value into a collection. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}.\n\t *\n\t * @param fn - Function that produces an element of the new collection, taking three arguments\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.mapValues(user => user.tag);\n\t * ```\n\t */\n\tpublic mapValues(fn: (value: V, key: K, collection: this) => T): Collection;\n\tpublic mapValues(fn: (this: This, value: V, key: K, collection: this) => T, thisArg: This): Collection;\n\tpublic mapValues(fn: (value: V, key: K, collection: this) => T, thisArg?: unknown): Collection {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tfor (const [key, val] of this) coll.set(key, fn(val, key, this));\n\t\treturn coll;\n\t}\n\n\t/**\n\t * Checks if there exists an item that passes a test. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some | Array.some()}.\n\t *\n\t * @param fn - Function used to test (should return a boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.some(user => user.discriminator === '0000');\n\t * ```\n\t */\n\tpublic some(fn: (value: V, key: K, collection: this) => unknown): boolean;\n\tpublic some(fn: (this: T, value: V, key: K, collection: this) => unknown, thisArg: T): boolean;\n\tpublic some(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): boolean {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfor (const [key, val] of this) {\n\t\t\tif (fn(val, key, this)) return true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Checks if all items passes a test. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every | Array.every()}.\n\t *\n\t * @param fn - Function used to test (should return a boolean)\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection.every(user => !user.bot);\n\t * ```\n\t */\n\tpublic every(fn: (value: V, key: K, collection: this) => key is K2): this is Collection;\n\tpublic every(fn: (value: V, key: K, collection: this) => value is V2): this is Collection;\n\tpublic every(fn: (value: V, key: K, collection: this) => unknown): boolean;\n\tpublic every(\n\t\tfn: (this: This, value: V, key: K, collection: this) => key is K2,\n\t\tthisArg: This,\n\t): this is Collection;\n\tpublic every(\n\t\tfn: (this: This, value: V, key: K, collection: this) => value is V2,\n\t\tthisArg: This,\n\t): this is Collection;\n\tpublic every(fn: (this: This, value: V, key: K, collection: this) => unknown, thisArg: This): boolean;\n\tpublic every(fn: (value: V, key: K, collection: this) => unknown, thisArg?: unknown): boolean {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfor (const [key, val] of this) {\n\t\t\tif (!fn(val, key, this)) return false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Applies a function to produce a single value. Identical in behavior to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce | Array.reduce()}.\n\t *\n\t * @param fn - Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`,\n\t * and `collection`\n\t * @param initialValue - Starting value for the accumulator\n\t * @example\n\t * ```ts\n\t * collection.reduce((acc, guild) => acc + guild.memberCount, 0);\n\t * ```\n\t */\n\tpublic reduce(fn: (accumulator: T, value: V, key: K, collection: this) => T, initialValue?: T): T {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tlet accumulator!: T;\n\n\t\tconst iterator = this.entries();\n\t\tif (initialValue === undefined) {\n\t\t\tif (this.size === 0) throw new TypeError('Reduce of empty collection with no initial value');\n\t\t\taccumulator = iterator.next().value[1];\n\t\t} else {\n\t\t\taccumulator = initialValue;\n\t\t}\n\n\t\tfor (const [key, value] of iterator) {\n\t\t\taccumulator = fn(accumulator, value, key, this);\n\t\t}\n\n\t\treturn accumulator;\n\t}\n\n\t/**\n\t * Identical to\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach | Map.forEach()},\n\t * but returns the collection instead of undefined.\n\t *\n\t * @param fn - Function to execute for each element\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection\n\t * .each(user => console.log(user.username))\n\t * .filter(user => user.bot)\n\t * .each(user => console.log(user.username));\n\t * ```\n\t */\n\tpublic each(fn: (value: V, key: K, collection: this) => void): this;\n\tpublic each(fn: (this: T, value: V, key: K, collection: this) => void, thisArg: T): this;\n\tpublic each(fn: (value: V, key: K, collection: this) => void, thisArg?: unknown): this {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\n\t\tfor (const [key, value] of this) {\n\t\t\tfn(value, key, this);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Runs a function on the collection and returns the collection.\n\t *\n\t * @param fn - Function to execute\n\t * @param thisArg - Value to use as `this` when executing function\n\t * @example\n\t * ```ts\n\t * collection\n\t * .tap(coll => console.log(coll.size))\n\t * .filter(user => user.bot)\n\t * .tap(coll => console.log(coll.size))\n\t * ```\n\t */\n\tpublic tap(fn: (collection: this) => void): this;\n\tpublic tap(fn: (this: T, collection: this) => void, thisArg: T): this;\n\tpublic tap(fn: (collection: this) => void, thisArg?: unknown): this {\n\t\tif (typeof fn !== 'function') throw new TypeError(`${fn} is not a function`);\n\t\tif (thisArg !== undefined) fn = fn.bind(thisArg);\n\t\tfn(this);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates an identical shallow copy of this collection.\n\t *\n\t * @example\n\t * ```ts\n\t * const newColl = someColl.clone();\n\t * ```\n\t */\n\tpublic clone(): Collection {\n\t\treturn new this.constructor[Symbol.species](this);\n\t}\n\n\t/**\n\t * Combines this collection with others into a new collection. None of the source collections are modified.\n\t *\n\t * @param collections - Collections to merge\n\t * @example\n\t * ```ts\n\t * const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);\n\t * ```\n\t */\n\tpublic concat(...collections: ReadonlyCollection[]) {\n\t\tconst newColl = this.clone();\n\t\tfor (const coll of collections) {\n\t\t\tfor (const [key, val] of coll) newColl.set(key, val);\n\t\t}\n\n\t\treturn newColl;\n\t}\n\n\t/**\n\t * Checks if this collection shares identical items with another.\n\t * This is different to checking for equality using equal-signs, because\n\t * the collections may be different objects, but contain the same data.\n\t *\n\t * @param collection - Collection to compare with\n\t * @returns Whether the collections have identical contents\n\t */\n\tpublic equals(collection: ReadonlyCollection) {\n\t\tif (!collection) return false; // runtime check\n\t\tif (this === collection) return true;\n\t\tif (this.size !== collection.size) return false;\n\t\tfor (const [key, value] of this) {\n\t\t\tif (!collection.has(key) || value !== collection.get(key)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * The sort method sorts the items of a collection in place and returns it.\n\t * The sort is not necessarily stable in Node 10 or older.\n\t * The default sort order is according to string Unicode code points.\n\t *\n\t * @param compareFunction - Specifies a function that defines the sort order.\n\t * If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.\n\t * @example\n\t * ```ts\n\t * collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);\n\t * ```\n\t */\n\tpublic sort(compareFunction: Comparator = Collection.defaultSort) {\n\t\tconst entries = [...this.entries()];\n\t\tentries.sort((a, b): number => compareFunction(a[1], b[1], a[0], b[0]));\n\n\t\t// Perform clean-up\n\t\tsuper.clear();\n\n\t\t// Set the new entries\n\t\tfor (const [key, value] of entries) {\n\t\t\tsuper.set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * The intersect method returns a new structure containing items where the keys and values are present in both original structures.\n\t *\n\t * @param other - The other Collection to filter against\n\t */\n\tpublic intersect(other: ReadonlyCollection): Collection {\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tfor (const [key, value] of other) {\n\t\t\tif (this.has(key) && Object.is(value, this.get(key))) {\n\t\t\t\tcoll.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\treturn coll;\n\t}\n\n\t/**\n\t * The subtract method returns a new structure containing items where the keys and values of the original structure are not present in the other.\n\t *\n\t * @param other - The other Collection to filter against\n\t */\n\tpublic subtract(other: ReadonlyCollection): Collection {\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tfor (const [key, value] of this) {\n\t\t\tif (!other.has(key) || !Object.is(value, other.get(key))) {\n\t\t\t\tcoll.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\treturn coll;\n\t}\n\n\t/**\n\t * The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.\n\t *\n\t * @param other - The other Collection to filter against\n\t */\n\tpublic difference(other: ReadonlyCollection): Collection {\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tfor (const [key, value] of other) {\n\t\t\tif (!this.has(key)) coll.set(key, value);\n\t\t}\n\n\t\tfor (const [key, value] of this) {\n\t\t\tif (!other.has(key)) coll.set(key, value);\n\t\t}\n\n\t\treturn coll;\n\t}\n\n\t/**\n\t * Merges two Collections together into a new Collection.\n\t *\n\t * @param other - The other Collection to merge with\n\t * @param whenInSelf - Function getting the result if the entry only exists in this Collection\n\t * @param whenInOther - Function getting the result if the entry only exists in the other Collection\n\t * @param whenInBoth - Function getting the result if the entry exists in both Collections\n\t * @example\n\t * ```ts\n\t * // Sums up the entries in two collections.\n\t * coll.merge(\n\t * other,\n\t * x => ({ keep: true, value: x }),\n\t * y => ({ keep: true, value: y }),\n\t * (x, y) => ({ keep: true, value: x + y }),\n\t * );\n\t * ```\n\t * @example\n\t * ```ts\n\t * // Intersects two collections in a left-biased manner.\n\t * coll.merge(\n\t * other,\n\t * x => ({ keep: false }),\n\t * y => ({ keep: false }),\n\t * (x, _) => ({ keep: true, value: x }),\n\t * );\n\t * ```\n\t */\n\tpublic merge(\n\t\tother: ReadonlyCollection,\n\t\twhenInSelf: (value: V, key: K) => Keep,\n\t\twhenInOther: (valueOther: T, key: K) => Keep,\n\t\twhenInBoth: (value: V, valueOther: T, key: K) => Keep,\n\t): Collection {\n\t\tconst coll = new this.constructor[Symbol.species]();\n\t\tconst keys = new Set([...this.keys(), ...other.keys()]);\n\n\t\tfor (const key of keys) {\n\t\t\tconst hasInSelf = this.has(key);\n\t\t\tconst hasInOther = other.has(key);\n\n\t\t\tif (hasInSelf && hasInOther) {\n\t\t\t\tconst result = whenInBoth(this.get(key)!, other.get(key)!, key);\n\t\t\t\tif (result.keep) coll.set(key, result.value);\n\t\t\t} else if (hasInSelf) {\n\t\t\t\tconst result = whenInSelf(this.get(key)!, key);\n\t\t\t\tif (result.keep) coll.set(key, result.value);\n\t\t\t} else if (hasInOther) {\n\t\t\t\tconst result = whenInOther(other.get(key)!, key);\n\t\t\t\tif (result.keep) coll.set(key, result.value);\n\t\t\t}\n\t\t}\n\n\t\treturn coll;\n\t}\n\n\t/**\n\t * The sorted method sorts the items of a collection and returns it.\n\t * The sort is not necessarily stable in Node 10 or older.\n\t * The default sort order is according to string Unicode code points.\n\t *\n\t * @param compareFunction - Specifies a function that defines the sort order.\n\t * If omitted, the collection is sorted according to each character's Unicode code point value,\n\t * according to the string conversion of each element.\n\t * @example\n\t * ```ts\n\t * collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);\n\t * ```\n\t */\n\tpublic sorted(compareFunction: Comparator = Collection.defaultSort) {\n\t\treturn new this.constructor[Symbol.species](this).sort((av, bv, ak, bk) => compareFunction(av, bv, ak, bk));\n\t}\n\n\tpublic toJSON() {\n\t\t// toJSON is called recursively by JSON.stringify.\n\t\treturn [...this.values()];\n\t}\n\n\tprivate static defaultSort(firstValue: V, secondValue: V): number {\n\t\treturn Number(firstValue > secondValue) || Number(firstValue === secondValue) - 1;\n\t}\n\n\t/**\n\t * Creates a Collection from a list of entries.\n\t *\n\t * @param entries - The list of entries\n\t * @param combine - Function to combine an existing entry with a new one\n\t * @example\n\t * ```ts\n\t * Collection.combineEntries([[\"a\", 1], [\"b\", 2], [\"a\", 2]], (x, y) => x + y);\n\t * // returns Collection { \"a\" => 3, \"b\" => 2 }\n\t * ```\n\t */\n\tpublic static combineEntries(\n\t\tentries: Iterable<[K, V]>,\n\t\tcombine: (firstValue: V, secondValue: V, key: K) => V,\n\t): Collection {\n\t\tconst coll = new Collection();\n\t\tfor (const [key, value] of entries) {\n\t\t\tif (coll.has(key)) {\n\t\t\t\tcoll.set(key, combine(coll.get(key)!, value, key));\n\t\t\t} else {\n\t\t\t\tcoll.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\treturn coll;\n\t}\n}\n\n/**\n * @internal\n */\nexport type Keep = { keep: false } | { keep: true; value: V };\n\n/**\n * @internal\n */\nexport type Comparator = (firstValue: V, secondValue: V, firstKey: K, secondKey: K) => number;\n","export * from './collection.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/collection/#readme | @discordjs/collection} version\n * that you are currently using.\n */\n// This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild\nexport const version = '1.5.3' as string;\n"],"mappings":";;;;AAqCO,IAAM,aAAN,MAAM,oBAAyB,IAAU;AAAA,EArChD,OAqCgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWxC,OAAO,KAAQ,uBAA2D;AAChF,QAAI,KAAK,IAAI,GAAG;AAAG,aAAO,KAAK,IAAI,GAAG;AACtC,QAAI,OAAO,0BAA0B;AAAY,YAAM,IAAI,UAAU,GAAG,qBAAqB,oBAAoB;AACjH,UAAM,eAAe,sBAAsB,KAAK,IAAI;AACpD,SAAK,IAAI,KAAK,YAAY;AAC1B,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,UAAU,MAAW;AAC3B,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AY,MAAM,IAAI,GAAG,GAAI,GAAG;AAC/C,YAAI,OAAO;AAAM,eAAK,IAAI,KAAK,OAAO,KAAK;AAAA,MAC5C;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeO,OAAO,kBAAoC,YAAW,aAAa;AACzE,WAAO,IAAI,KAAK,YAAY,OAAO,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,IAAI,OAAO,gBAAgB,IAAI,IAAI,IAAI,EAAE,CAAC;AAAA,EAC3G;AAAA,EAEO,SAAS;AAEf,WAAO,CAAC,GAAG,KAAK,OAAO,CAAC;AAAA,EACzB;AAAA,EAEA,OAAe,YAAe,YAAe,aAAwB;AACpE,WAAO,OAAO,aAAa,WAAW,KAAK,OAAO,eAAe,WAAW,IAAI;AAAA,EACjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,OAAc,eACb,SACA,SACmB;AACnB,UAAM,OAAO,IAAI,YAAiB;AAClC,eAAW,CAAC,KAAK,KAAK,KAAK,SAAS;AACnC,UAAI,KAAK,IAAI,GAAG,GAAG;AAClB,aAAK,IAAI,KAAK,QAAQ,KAAK,IAAI,GAAG,GAAI,OAAO,GAAG,CAAC;AAAA,MAClD,OAAO;AACN,aAAK,IAAI,KAAK,KAAK;AAAA,MACpB;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AACD;;;AC9yBO,IAAM,UAAU;","names":[]} \ No newline at end of file diff --git a/node_modules/@discordjs/collection/package.json b/node_modules/@discordjs/collection/package.json new file mode 100644 index 0000000..81e2418 --- /dev/null +++ b/node_modules/@discordjs/collection/package.json @@ -0,0 +1,76 @@ +{ + "name": "@discordjs/collection", + "version": "1.5.3", + "description": "Utility data structure used in discord.js", + "scripts": { + "test": "vitest run", + "build": "tsup", + "build:docs": "tsc -p tsconfig.docs.json", + "lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty", + "format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty", + "fmt": "yarn format", + "docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json", + "prepack": "yarn lint && yarn test && yarn build", + "changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/collection/*'", + "release": "cliff-jumper" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "directories": { + "lib": "src", + "test": "__tests__" + }, + "files": [ + "dist" + ], + "contributors": [ + "Crawl ", + "Amish Shah ", + "SpaceEEC ", + "Vlad Frangu ", + "Aura Román " + ], + "license": "Apache-2.0", + "keywords": [ + "map", + "collection", + "utility" + ], + "repository": { + "type": "git", + "url": "https://github.com/discordjs/discord.js.git", + "directory": "packages/collection" + }, + "bugs": { + "url": "https://github.com/discordjs/discord.js/issues" + }, + "homepage": "https://discord.js.org", + "devDependencies": { + "@favware/cliff-jumper": "^2.1.1", + "@microsoft/api-extractor": "^7.36.4", + "@types/node": "16.18.40", + "@vitest/coverage-v8": "^0.34.2", + "cross-env": "^7.0.3", + "esbuild-plugin-version-injector": "^1.2.0", + "eslint": "^8.47.0", + "eslint-config-neon": "^0.1.47", + "eslint-formatter-pretty": "^5.0.0", + "prettier": "^2.8.8", + "tsup": "^7.2.0", + "turbo": "^1.10.12", + "typescript": "^5.1.6", + "vitest": "^0.34.2" + }, + "engines": { + "node": ">=16.11.0" + }, + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/node_modules/@discordjs/formatters/LICENSE b/node_modules/@discordjs/formatters/LICENSE new file mode 100644 index 0000000..e2baac1 --- /dev/null +++ b/node_modules/@discordjs/formatters/LICENSE @@ -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. diff --git a/node_modules/@discordjs/formatters/README.md b/node_modules/@discordjs/formatters/README.md new file mode 100644 index 0000000..65ad4b0 --- /dev/null +++ b/node_modules/@discordjs/formatters/README.md @@ -0,0 +1,82 @@ +
+
+

+ discord.js +

+
+

+ Discord server + npm version + npm downloads + Build status + Code coverage +

+

+ Vercel + Cloudflare Workers +

+
+ +## 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 diff --git a/node_modules/@discordjs/formatters/dist/index.d.mts b/node_modules/@discordjs/formatters/dist/index.d.mts new file mode 100644 index 0000000..0240f6b --- /dev/null +++ b/node_modules/@discordjs/formatters/dist/index.d.mts @@ -0,0 +1,586 @@ +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: 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: 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: 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: 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: Content): `**${Content}**`; +/** + * Formats the content into underscored text. + * + * @typeParam Content - This is inferred by the supplied content + * @param content - The content to wrap + */ +declare function underscore(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: 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: 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: 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(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: 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: 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: 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: 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: 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: 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: 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: 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: CommandName, subcommandGroupName: SubcommandGroupName, subcommandName: SubcommandName, commandId: 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: CommandName, subcommandName: SubcommandName, commandId: 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: CommandName, commandId: 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: 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: EmojiId, animated?: true): ``; +/** + * 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: EmojiId, animated?: boolean): `<:_:${EmojiId}>` | ``; +/** + * 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: 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: 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: 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: 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: 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: 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: Content, level: HeadingLevel.Three): `### ${Content}`; +/** + * A type that recursively traverses into arrays. + */ +type RecursiveArray = readonly (ItemType | RecursiveArray)[]; +/** + * 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, 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; +/** + * 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): ``; +/** + * 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