deleted node_modules
This commit is contained in:
-1
@@ -1 +0,0 @@
|
|||||||
../detect-libc/bin/detect-libc.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../mime/cli.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../mkdirp/bin/cmd.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../node/bin/node
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../@mapbox/node-pre-gyp/bin/node-pre-gyp
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../nopt/bin/nopt.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../rimraf/bin.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../semver/bin/semver.js
|
|
||||||
-1415
File diff suppressed because it is too large
Load Diff
-190
@@ -1,190 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
Copyright 2021 Vlad Frangu
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
<div align="center">
|
|
||||||
<br />
|
|
||||||
<p>
|
|
||||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
|
||||||
</p>
|
|
||||||
<br />
|
|
||||||
<p>
|
|
||||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
|
||||||
<a href="https://github.com/discordjs/builders/actions"><img src="https://github.com/discordjs/builders/workflows/Tests/badge.svg" alt="Test status" /></a>
|
|
||||||
<a href="https://github.com/discordjs/builders/actions"><img src="https://github.com/discordjs/builders/workflows/Lint/badge.svg" alt="Lint status" /></a>
|
|
||||||
<a href="https://codecov.io/gh/discordjs/builders"><img src="https://codecov.io/gh/discordjs/builders/branch/main/graph/badge.svg" alt="Code coverage" /></a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Install with [npm](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install @discordjs/builders
|
|
||||||
yarn add @discordjs/builders
|
|
||||||
pnpm add @discordjs/builders
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contribution
|
|
||||||
|
|
||||||
See [Contributing Guide](https://github.com/discordjs/builders/blob/main/.github/CONTRIBUTING.md).
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
Here are some examples for the builders and utilities you can find in this package:
|
|
||||||
|
|
||||||
- [Slash Command Builders](./docs/examples/Slash%20Command%20Builders.md)
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
export * as EmbedAssertions from './messages/embed/Assertions';
|
|
||||||
export * from './messages/embed/Embed';
|
|
||||||
export * from './messages/formatters';
|
|
||||||
export * as SlashCommandAssertions from './interactions/slashCommands/Assertions';
|
|
||||||
export * from './interactions/slashCommands/SlashCommandBuilder';
|
|
||||||
export * from './interactions/slashCommands/SlashCommandSubcommands';
|
|
||||||
export * from './interactions/slashCommands/options/boolean';
|
|
||||||
export * from './interactions/slashCommands/options/channel';
|
|
||||||
export * from './interactions/slashCommands/options/integer';
|
|
||||||
export * from './interactions/slashCommands/options/mentionable';
|
|
||||||
export * from './interactions/slashCommands/options/number';
|
|
||||||
export * from './interactions/slashCommands/options/role';
|
|
||||||
export * from './interactions/slashCommands/options/string';
|
|
||||||
export * from './interactions/slashCommands/options/user';
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAEtC,OAAO,KAAK,sBAAsB,MAAM,yCAAyC,CAAC;AAClF,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kDAAkD,CAAC;AACjE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC"}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandAssertions = exports.EmbedAssertions = void 0;
|
|
||||||
const tslib_1 = require("tslib");
|
|
||||||
exports.EmbedAssertions = tslib_1.__importStar(require("./messages/embed/Assertions"));
|
|
||||||
tslib_1.__exportStar(require("./messages/embed/Embed"), exports);
|
|
||||||
tslib_1.__exportStar(require("./messages/formatters"), exports);
|
|
||||||
exports.SlashCommandAssertions = tslib_1.__importStar(require("./interactions/slashCommands/Assertions"));
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/SlashCommandBuilder"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/SlashCommandSubcommands"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/boolean"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/channel"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/integer"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/mentionable"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/number"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/role"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/string"), exports);
|
|
||||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/user"), exports);
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,uFAA+D;AAC/D,iEAAuC;AACvC,gEAAsC;AAEtC,0GAAkF;AAClF,2FAAiE;AACjE,+FAAqE;AACrE,uFAA6D;AAC7D,uFAA6D;AAC7D,uFAA6D;AAC7D,2FAAiE;AACjE,sFAA4D;AAC5D,oFAA0D;AAC1D,sFAA4D;AAC5D,oFAA0D","sourcesContent":["export * as EmbedAssertions from './messages/embed/Assertions';\nexport * from './messages/embed/Embed';\nexport * from './messages/formatters';\n\nexport * as SlashCommandAssertions from './interactions/slashCommands/Assertions';\nexport * from './interactions/slashCommands/SlashCommandBuilder';\nexport * from './interactions/slashCommands/SlashCommandSubcommands';\nexport * from './interactions/slashCommands/options/boolean';\nexport * from './interactions/slashCommands/options/channel';\nexport * from './interactions/slashCommands/options/integer';\nexport * from './interactions/slashCommands/options/mentionable';\nexport * from './interactions/slashCommands/options/number';\nexport * from './interactions/slashCommands/options/role';\nexport * from './interactions/slashCommands/options/string';\nexport * from './interactions/slashCommands/options/user';\n"]}
|
|
||||||
-36
@@ -1,36 +0,0 @@
|
|||||||
import mod from "./index.js";
|
|
||||||
|
|
||||||
export default mod;
|
|
||||||
export const Embed = mod.Embed;
|
|
||||||
export const EmbedAssertions = mod.EmbedAssertions;
|
|
||||||
export const Faces = mod.Faces;
|
|
||||||
export const SlashCommandAssertions = mod.SlashCommandAssertions;
|
|
||||||
export const SlashCommandBooleanOption = mod.SlashCommandBooleanOption;
|
|
||||||
export const SlashCommandBuilder = mod.SlashCommandBuilder;
|
|
||||||
export const SlashCommandChannelOption = mod.SlashCommandChannelOption;
|
|
||||||
export const SlashCommandIntegerOption = mod.SlashCommandIntegerOption;
|
|
||||||
export const SlashCommandMentionableOption = mod.SlashCommandMentionableOption;
|
|
||||||
export const SlashCommandNumberOption = mod.SlashCommandNumberOption;
|
|
||||||
export const SlashCommandRoleOption = mod.SlashCommandRoleOption;
|
|
||||||
export const SlashCommandStringOption = mod.SlashCommandStringOption;
|
|
||||||
export const SlashCommandSubcommandBuilder = mod.SlashCommandSubcommandBuilder;
|
|
||||||
export const SlashCommandSubcommandGroupBuilder = mod.SlashCommandSubcommandGroupBuilder;
|
|
||||||
export const SlashCommandUserOption = mod.SlashCommandUserOption;
|
|
||||||
export const TimestampStyles = mod.TimestampStyles;
|
|
||||||
export const blockQuote = mod.blockQuote;
|
|
||||||
export const bold = mod.bold;
|
|
||||||
export const channelMention = mod.channelMention;
|
|
||||||
export const codeBlock = mod.codeBlock;
|
|
||||||
export const formatEmoji = mod.formatEmoji;
|
|
||||||
export const hideLinkEmbed = mod.hideLinkEmbed;
|
|
||||||
export const hyperlink = mod.hyperlink;
|
|
||||||
export const inlineCode = mod.inlineCode;
|
|
||||||
export const italic = mod.italic;
|
|
||||||
export const memberNicknameMention = mod.memberNicknameMention;
|
|
||||||
export const quote = mod.quote;
|
|
||||||
export const roleMention = mod.roleMention;
|
|
||||||
export const spoiler = mod.spoiler;
|
|
||||||
export const strikethrough = mod.strikethrough;
|
|
||||||
export const time = mod.time;
|
|
||||||
export const underscore = mod.underscore;
|
|
||||||
export const userMention = mod.userMention;
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
import type { APIApplicationCommandOptionChoice } from 'discord-api-types/v9';
|
|
||||||
import type { SlashCommandOptionBase } from './mixins/CommandOptionBase';
|
|
||||||
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';
|
|
||||||
import type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
|
|
||||||
export declare function validateRequiredParameters(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
|
|
||||||
export declare function validateName(name: unknown): asserts name is string;
|
|
||||||
export declare function validateDescription(description: unknown): asserts description is string;
|
|
||||||
export declare function validateDefaultPermission(value: unknown): asserts value is boolean;
|
|
||||||
export declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
|
|
||||||
export declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
|
|
||||||
export declare function assertReturnOfBuilder<T extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
|
|
||||||
//# sourceMappingURL=Assertions.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"Assertions.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/Assertions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAEnH,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,8BAA8B,EAAE,QAUzC;AAUD,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAElE;AAID,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,CAEvF;AAID,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAElF;AAID,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,8BAA8B,EAAE,CAE9G;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iCAAiC,EAAE,QAEpF;AAED,wBAAgB,qBAAqB,CACpC,CAAC,SAAS,sBAAsB,GAAG,6BAA6B,GAAG,kCAAkC,EACpG,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAuBrE"}
|
|
||||||
-63
@@ -1,63 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.assertReturnOfBuilder = exports.validateMaxChoicesLength = exports.validateMaxOptionsLength = exports.validateDefaultPermission = exports.validateDescription = exports.validateName = exports.validateRequiredParameters = void 0;
|
|
||||||
const tslib_1 = require("tslib");
|
|
||||||
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
|
||||||
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
||||||
function validateRequiredParameters(name, description, options) {
|
|
||||||
// Assert name matches all conditions
|
|
||||||
validateName(name);
|
|
||||||
// Assert description conditions
|
|
||||||
validateDescription(description);
|
|
||||||
// Assert options conditions
|
|
||||||
validateMaxOptionsLength(options);
|
|
||||||
}
|
|
||||||
exports.validateRequiredParameters = validateRequiredParameters;
|
|
||||||
const namePredicate = ow_1.default.string.lowercase
|
|
||||||
.minLength(1)
|
|
||||||
.maxLength(32)
|
|
||||||
.addValidator({
|
|
||||||
message: (value, label) => `Expected ${label} to match "^[\\p{L}\\p{N}_-]+$", got ${value} instead`,
|
|
||||||
validator: (value) => /^[\p{L}\p{N}_-]+$/u.test(value),
|
|
||||||
});
|
|
||||||
function validateName(name) {
|
|
||||||
ow_1.default(name, 'name', namePredicate);
|
|
||||||
}
|
|
||||||
exports.validateName = validateName;
|
|
||||||
const descriptionPredicate = ow_1.default.string.minLength(1).maxLength(100);
|
|
||||||
function validateDescription(description) {
|
|
||||||
ow_1.default(description, 'description', descriptionPredicate);
|
|
||||||
}
|
|
||||||
exports.validateDescription = validateDescription;
|
|
||||||
const defaultPermissionPredicate = ow_1.default.boolean;
|
|
||||||
function validateDefaultPermission(value) {
|
|
||||||
ow_1.default(value, 'default_permission', defaultPermissionPredicate);
|
|
||||||
}
|
|
||||||
exports.validateDefaultPermission = validateDefaultPermission;
|
|
||||||
const maxArrayLengthPredicate = ow_1.default.array.maxLength(25);
|
|
||||||
function validateMaxOptionsLength(options) {
|
|
||||||
ow_1.default(options, 'options', maxArrayLengthPredicate);
|
|
||||||
}
|
|
||||||
exports.validateMaxOptionsLength = validateMaxOptionsLength;
|
|
||||||
function validateMaxChoicesLength(choices) {
|
|
||||||
ow_1.default(choices, 'choices', maxArrayLengthPredicate);
|
|
||||||
}
|
|
||||||
exports.validateMaxChoicesLength = validateMaxChoicesLength;
|
|
||||||
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
|
||||||
const instanceName = ExpectedInstanceOf.name;
|
|
||||||
if (is_1.default.nullOrUndefined(input)) {
|
|
||||||
throw new TypeError(`Expected to receive a ${instanceName} builder, got ${input === null ? 'null' : 'undefined'} instead.`);
|
|
||||||
}
|
|
||||||
if (is_1.default.primitive(input)) {
|
|
||||||
throw new TypeError(`Expected to receive a ${instanceName} builder, got a primitive (${typeof input}) instead.`);
|
|
||||||
}
|
|
||||||
if (!(input instanceof ExpectedInstanceOf)) {
|
|
||||||
const casted = input;
|
|
||||||
const constructorName = is_1.default.function_(input) ? input.name : casted.constructor.name;
|
|
||||||
const stringTag = Reflect.get(casted, Symbol.toStringTag);
|
|
||||||
const fullResultName = stringTag ? `${constructorName} [${stringTag}]` : constructorName;
|
|
||||||
throw new TypeError(`Expected to receive a ${instanceName} builder, got ${fullResultName} instead.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.assertReturnOfBuilder = assertReturnOfBuilder;
|
|
||||||
//# sourceMappingURL=Assertions.js.map
|
|
||||||
Generated
Vendored
-1
File diff suppressed because one or more lines are too long
Generated
Vendored
-63
@@ -1,63 +0,0 @@
|
|||||||
import type { APIApplicationCommandOption } from 'discord-api-types/v9';
|
|
||||||
import { SharedSlashCommandOptions } from './mixins/CommandOptions';
|
|
||||||
import { SharedNameAndDescription } from './mixins/NameAndDescription';
|
|
||||||
import { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
|
|
||||||
export declare class SlashCommandBuilder {
|
|
||||||
/**
|
|
||||||
* The name of this slash command
|
|
||||||
*/
|
|
||||||
readonly name: string;
|
|
||||||
/**
|
|
||||||
* The description of this slash command
|
|
||||||
*/
|
|
||||||
readonly description: string;
|
|
||||||
/**
|
|
||||||
* The options of this slash command
|
|
||||||
*/
|
|
||||||
readonly options: ToAPIApplicationCommandOptions[];
|
|
||||||
/**
|
|
||||||
* Whether the command is enabled by default when the app is added to a guild
|
|
||||||
* @default true
|
|
||||||
*/
|
|
||||||
readonly defaultPermission: boolean | undefined;
|
|
||||||
/**
|
|
||||||
* Returns the final data that should be sent to Discord.
|
|
||||||
*
|
|
||||||
* **Note:** Calling this function will validate required properties based on their conditions.
|
|
||||||
*/
|
|
||||||
toJSON(): {
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
options: APIApplicationCommandOption[];
|
|
||||||
default_permission: boolean | undefined;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Sets whether the command is enabled by default when the application is added to a guild.
|
|
||||||
*
|
|
||||||
* **Note**: If set to `false`, you will have to later have to `PUT` the permissions for this command.
|
|
||||||
* @param value Whether or not to enable this command by default
|
|
||||||
*
|
|
||||||
* @see https://discord.com/developers/docs/interactions/slash-commands#permissions
|
|
||||||
*/
|
|
||||||
setDefaultPermission(value: 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;
|
|
||||||
}
|
|
||||||
export interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {
|
|
||||||
}
|
|
||||||
export interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, Pick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {
|
|
||||||
}
|
|
||||||
export interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
|
|
||||||
}
|
|
||||||
export interface ToAPIApplicationCommandOptions {
|
|
||||||
toJSON(): APIApplicationCommandOption;
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=SlashCommandBuilder.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"SlashCommandBuilder.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAQxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAE9G,qBACa,mBAAmB;IAC/B;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAE/D;;;OAGG;IACH,SAAgB,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAa;IAEnE;;;;OAIG;IACI,MAAM;;;;;;IAUb;;;;;;;OAOG;IACI,oBAAoB,CAAC,KAAK,EAAE,OAAO;IAS1C;;;OAGG;IACI,kBAAkB,CACxB,KAAK,EACF,kCAAkC,GAClC,CAAC,CAAC,eAAe,EAAE,kCAAkC,KAAK,kCAAkC,CAAC,GAC9F,kCAAkC;IAiBrC;;;OAGG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC,GACpF,kCAAkC;CAgBrC;AAED,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB,EAAE,yBAAyB;CAAG;AAEnG,MAAM,WAAW,kCAChB,SAAQ,wBAAwB,EAC/B,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,eAAe,GAAG,oBAAoB,CAAC;CAAG;AAEjF,MAAM,WAAW,8BAChB,SAAQ,wBAAwB,EAC/B,yBAAyB,EACzB,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC;CAAG;AAExC,MAAM,WAAW,8BAA8B;IAC9C,MAAM,IAAI,2BAA2B,CAAC;CACtC"}
|
|
||||||
Generated
Vendored
-113
@@ -1,113 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandBuilder = void 0;
|
|
||||||
const tslib_1 = require("tslib");
|
|
||||||
const ts_mixer_1 = require("ts-mixer");
|
|
||||||
const Assertions_1 = require("./Assertions");
|
|
||||||
const CommandOptions_1 = require("./mixins/CommandOptions");
|
|
||||||
const NameAndDescription_1 = require("./mixins/NameAndDescription");
|
|
||||||
const SlashCommandSubcommands_1 = require("./SlashCommandSubcommands");
|
|
||||||
let SlashCommandBuilder = class SlashCommandBuilder {
|
|
||||||
constructor() {
|
|
||||||
/**
|
|
||||||
* The name of this slash command
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "name", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: undefined
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The description of this slash command
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "description", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: undefined
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The options of this slash command
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "options", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: []
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* Whether the command is enabled by default when the app is added to a guild
|
|
||||||
* @default true
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "defaultPermission", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: undefined
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the final data that should be sent to Discord.
|
|
||||||
*
|
|
||||||
* **Note:** Calling this function will validate required properties based on their conditions.
|
|
||||||
*/
|
|
||||||
toJSON() {
|
|
||||||
Assertions_1.validateRequiredParameters(this.name, this.description, this.options);
|
|
||||||
return {
|
|
||||||
name: this.name,
|
|
||||||
description: this.description,
|
|
||||||
options: this.options.map((option) => option.toJSON()),
|
|
||||||
default_permission: this.defaultPermission,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets whether the command is enabled by default when the application is added to a guild.
|
|
||||||
*
|
|
||||||
* **Note**: If set to `false`, you will have to later have to `PUT` the permissions for this command.
|
|
||||||
* @param value Whether or not to enable this command by default
|
|
||||||
*
|
|
||||||
* @see https://discord.com/developers/docs/interactions/slash-commands#permissions
|
|
||||||
*/
|
|
||||||
setDefaultPermission(value) {
|
|
||||||
// Assert the value matches the conditions
|
|
||||||
Assertions_1.validateDefaultPermission(value);
|
|
||||||
Reflect.set(this, 'defaultPermission', value);
|
|
||||||
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;
|
|
||||||
// First, assert options conditions - we cannot have more than 25 options
|
|
||||||
Assertions_1.validateMaxOptionsLength(options);
|
|
||||||
// Get the final result
|
|
||||||
const result = typeof input === 'function' ? input(new SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder()) : input;
|
|
||||||
Assertions_1.assertReturnOfBuilder(result, SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder);
|
|
||||||
// Push it
|
|
||||||
options.push(result);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
// First, assert options conditions - we cannot have more than 25 options
|
|
||||||
Assertions_1.validateMaxOptionsLength(options);
|
|
||||||
// Get the final result
|
|
||||||
const result = typeof input === 'function' ? input(new SlashCommandSubcommands_1.SlashCommandSubcommandBuilder()) : input;
|
|
||||||
Assertions_1.assertReturnOfBuilder(result, SlashCommandSubcommands_1.SlashCommandSubcommandBuilder);
|
|
||||||
// Push it
|
|
||||||
options.push(result);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
SlashCommandBuilder = tslib_1.__decorate([
|
|
||||||
ts_mixer_1.mix(CommandOptions_1.SharedSlashCommandOptions, NameAndDescription_1.SharedNameAndDescription)
|
|
||||||
], SlashCommandBuilder);
|
|
||||||
exports.SlashCommandBuilder = SlashCommandBuilder;
|
|
||||||
//# sourceMappingURL=SlashCommandBuilder.js.map
|
|
||||||
Generated
Vendored
-1
File diff suppressed because one or more lines are too long
Generated
Vendored
-64
@@ -1,64 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { SharedSlashCommandOptions } from './mixins/CommandOptions';
|
|
||||||
import { SharedNameAndDescription } from './mixins/NameAndDescription';
|
|
||||||
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';
|
|
||||||
/**
|
|
||||||
* Represents a folder for subcommands
|
|
||||||
*
|
|
||||||
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
|
||||||
*/
|
|
||||||
export 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 part of this subcommand group
|
|
||||||
*/
|
|
||||||
readonly options: ToAPIApplicationCommandOptions[];
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
toJSON(): {
|
|
||||||
type: ApplicationCommandOptionType;
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
options: import("discord-api-types/v9").APIApplicationCommandOption[];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Represents a subcommand
|
|
||||||
*
|
|
||||||
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
|
||||||
*/
|
|
||||||
export declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
|
|
||||||
/**
|
|
||||||
* The name of this subcommand
|
|
||||||
*/
|
|
||||||
readonly name: string;
|
|
||||||
/**
|
|
||||||
* The description of this subcommand
|
|
||||||
*/
|
|
||||||
readonly description: string;
|
|
||||||
/**
|
|
||||||
* The options of this subcommand
|
|
||||||
*/
|
|
||||||
readonly options: ToAPIApplicationCommandOptions[];
|
|
||||||
toJSON(): {
|
|
||||||
type: ApplicationCommandOptionType;
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
options: import("discord-api-types/v9").APIApplicationCommandOption[];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions<false> {
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=SlashCommandSubcommands.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"SlashCommandSubcommands.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandSubcommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAE5E;;;;GAIG;AACH,qBACa,kCAAmC,YAAW,8BAA8B;IACxF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAE/D;;;OAGG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC;IAkBhF,MAAM;;;;;;CASb;AAED,MAAM,WAAW,kCAAmC,SAAQ,wBAAwB;CAAG;AAEvF;;;;GAIG;AACH,qBACa,6BAA8B,YAAW,8BAA8B;IACnF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAExD,MAAM;;;;;;CASb;AAED,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB,EAAE,yBAAyB,CAAC,KAAK,CAAC;CAAG"}
|
|
||||||
Generated
Vendored
-123
@@ -1,123 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandSubcommandBuilder = exports.SlashCommandSubcommandGroupBuilder = void 0;
|
|
||||||
const tslib_1 = require("tslib");
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const ts_mixer_1 = require("ts-mixer");
|
|
||||||
const Assertions_1 = require("./Assertions");
|
|
||||||
const CommandOptions_1 = require("./mixins/CommandOptions");
|
|
||||||
const NameAndDescription_1 = require("./mixins/NameAndDescription");
|
|
||||||
/**
|
|
||||||
* Represents a folder for subcommands
|
|
||||||
*
|
|
||||||
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
|
||||||
*/
|
|
||||||
let SlashCommandSubcommandGroupBuilder = class SlashCommandSubcommandGroupBuilder {
|
|
||||||
constructor() {
|
|
||||||
/**
|
|
||||||
* The name of this subcommand group
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "name", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: undefined
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The description of this subcommand group
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "description", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: undefined
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The subcommands part of this subcommand group
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "options", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
// First, assert options conditions - we cannot have more than 25 options
|
|
||||||
Assertions_1.validateMaxOptionsLength(options);
|
|
||||||
// Get the final result
|
|
||||||
const result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;
|
|
||||||
Assertions_1.assertReturnOfBuilder(result, SlashCommandSubcommandBuilder);
|
|
||||||
// Push it
|
|
||||||
options.push(result);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
toJSON() {
|
|
||||||
Assertions_1.validateRequiredParameters(this.name, this.description, this.options);
|
|
||||||
return {
|
|
||||||
type: 2 /* SubcommandGroup */,
|
|
||||||
name: this.name,
|
|
||||||
description: this.description,
|
|
||||||
options: this.options.map((option) => option.toJSON()),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
SlashCommandSubcommandGroupBuilder = tslib_1.__decorate([
|
|
||||||
ts_mixer_1.mix(NameAndDescription_1.SharedNameAndDescription)
|
|
||||||
], SlashCommandSubcommandGroupBuilder);
|
|
||||||
exports.SlashCommandSubcommandGroupBuilder = SlashCommandSubcommandGroupBuilder;
|
|
||||||
/**
|
|
||||||
* Represents a subcommand
|
|
||||||
*
|
|
||||||
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
|
||||||
*/
|
|
||||||
let SlashCommandSubcommandBuilder = class SlashCommandSubcommandBuilder {
|
|
||||||
constructor() {
|
|
||||||
/**
|
|
||||||
* The name of this subcommand
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "name", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: undefined
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The description of this subcommand
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "description", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: undefined
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The options of this subcommand
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "options", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
toJSON() {
|
|
||||||
Assertions_1.validateRequiredParameters(this.name, this.description, this.options);
|
|
||||||
return {
|
|
||||||
type: 1 /* Subcommand */,
|
|
||||||
name: this.name,
|
|
||||||
description: this.description,
|
|
||||||
options: this.options.map((option) => option.toJSON()),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
SlashCommandSubcommandBuilder = tslib_1.__decorate([
|
|
||||||
ts_mixer_1.mix(NameAndDescription_1.SharedNameAndDescription, CommandOptions_1.SharedSlashCommandOptions)
|
|
||||||
], SlashCommandSubcommandBuilder);
|
|
||||||
exports.SlashCommandSubcommandBuilder = SlashCommandSubcommandBuilder;
|
|
||||||
//# sourceMappingURL=SlashCommandSubcommands.js.map
|
|
||||||
Generated
Vendored
-1
File diff suppressed because one or more lines are too long
Generated
Vendored
-20
@@ -1,20 +0,0 @@
|
|||||||
import type { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
|
||||||
import { SharedNameAndDescription } from './NameAndDescription';
|
|
||||||
export declare class SlashCommandOptionBase extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {
|
|
||||||
required: boolean;
|
|
||||||
readonly type: ApplicationCommandOptionType;
|
|
||||||
constructor(type: ApplicationCommandOptionType);
|
|
||||||
/**
|
|
||||||
* Marks the option as required
|
|
||||||
* @param required If this option should be required
|
|
||||||
*/
|
|
||||||
setRequired(required: boolean): this;
|
|
||||||
toJSON(): {
|
|
||||||
type: ApplicationCommandOptionType;
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
required: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=CommandOptionBase.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"CommandOptionBase.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,qBAAa,sBAAuB,SAAQ,wBAAyB,YAAW,8BAA8B;IACtG,QAAQ,UAAS;IACxB,SAAgB,IAAI,EAAE,4BAA4B,CAAC;gBAEhC,IAAI,EAAE,4BAA4B;IAKrD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO;IAS7B,MAAM;;;;;;CAab"}
|
|
||||||
Generated
Vendored
-48
@@ -1,48 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandOptionBase = void 0;
|
|
||||||
const tslib_1 = require("tslib");
|
|
||||||
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
||||||
const Assertions_1 = require("../Assertions");
|
|
||||||
const NameAndDescription_1 = require("./NameAndDescription");
|
|
||||||
class SlashCommandOptionBase extends NameAndDescription_1.SharedNameAndDescription {
|
|
||||||
constructor(type) {
|
|
||||||
super();
|
|
||||||
Object.defineProperty(this, "required", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: false
|
|
||||||
});
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Marks the option as required
|
|
||||||
* @param required If this option should be required
|
|
||||||
*/
|
|
||||||
setRequired(required) {
|
|
||||||
// Assert that you actually passed a boolean
|
|
||||||
ow_1.default(required, 'required', ow_1.default.boolean);
|
|
||||||
this.required = required;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
toJSON() {
|
|
||||||
Assertions_1.validateRequiredParameters(this.name, this.description, []);
|
|
||||||
// Assert that you actually passed a boolean
|
|
||||||
ow_1.default(this.required, 'required', ow_1.default.boolean);
|
|
||||||
return {
|
|
||||||
type: this.type,
|
|
||||||
name: this.name,
|
|
||||||
description: this.description,
|
|
||||||
required: this.required,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandOptionBase = SlashCommandOptionBase;
|
|
||||||
//# sourceMappingURL=CommandOptionBase.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"CommandOptionBase.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionBase.ts"],"names":[],"mappings":";;;;AACA,oDAAoB;AACpB,8CAA2D;AAE3D,6DAAgE;AAEhE,MAAa,sBAAuB,SAAQ,6CAAwB;IAInE,YAAmB,IAAkC;QACpD,KAAK,EAAE,CAAC;QAJT;;;;mBAAkB,KAAK;WAAC;QACxB;;;;;WAAmD;QAIlD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,QAAiB;QACnC,4CAA4C;QAC5C,YAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAE,CAAC,OAAO,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM;QACZ,uCAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAE5D,4CAA4C;QAC5C,YAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAE,CAAC,OAAO,CAAC,CAAC;QAE1C,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC;IACH,CAAC;CACD;AAnCD,wDAmCC","sourcesContent":["import type { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport ow from 'ow';\nimport { validateRequiredParameters } from '../Assertions';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SharedNameAndDescription } from './NameAndDescription';\n\nexport class SlashCommandOptionBase extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {\n\tpublic required = false;\n\tpublic readonly type: ApplicationCommandOptionType;\n\n\tpublic constructor(type: ApplicationCommandOptionType) {\n\t\tsuper();\n\t\tthis.type = type;\n\t}\n\n\t/**\n\t * Marks the option as required\n\t * @param required If this option should be required\n\t */\n\tpublic setRequired(required: boolean) {\n\t\t// Assert that you actually passed a boolean\n\t\tow(required, 'required', ow.boolean);\n\n\t\tthis.required = required;\n\n\t\treturn this;\n\t}\n\n\tpublic toJSON() {\n\t\tvalidateRequiredParameters(this.name, this.description, []);\n\n\t\t// Assert that you actually passed a boolean\n\t\tow(this.required, 'required', ow.boolean);\n\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\trequired: this.required,\n\t\t};\n\t}\n}\n"]}
|
|
||||||
Generated
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
import { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
|
||||||
import { SlashCommandOptionBase } from './CommandOptionBase';
|
|
||||||
export declare abstract class ApplicationCommandOptionWithChoicesBase<T extends string | number> extends SlashCommandOptionBase implements ToAPIApplicationCommandOptions {
|
|
||||||
choices?: APIApplicationCommandOptionChoice[];
|
|
||||||
/**
|
|
||||||
* Adds a choice for this option
|
|
||||||
* @param name The name of the choice
|
|
||||||
* @param value The value of the choice
|
|
||||||
*/
|
|
||||||
addChoice(name: string, value: T): this;
|
|
||||||
/**
|
|
||||||
* Adds multiple choices for this option
|
|
||||||
* @param choices The choices to add
|
|
||||||
*/
|
|
||||||
addChoices(choices: [name: string, value: T][]): this;
|
|
||||||
toJSON(): {
|
|
||||||
choices: APIApplicationCommandOptionChoice[] | undefined;
|
|
||||||
type: ApplicationCommandOptionType;
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
required: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=CommandOptionWithChoices.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"CommandOptionWithChoices.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionWithChoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGvG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAU7D,8BAAsB,uCAAuC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CACtF,SAAQ,sBACR,YAAW,8BAA8B;IAElC,OAAO,CAAC,EAAE,iCAAiC,EAAE,CAAC;IAErD;;;;OAIG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAiBvC;;;OAGG;IACI,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE;IAOrC,MAAM;;;;;;;CAMtB"}
|
|
||||||
Generated
Vendored
-71
@@ -1,71 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.ApplicationCommandOptionWithChoicesBase = void 0;
|
|
||||||
const tslib_1 = require("tslib");
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
||||||
const Assertions_1 = require("../Assertions");
|
|
||||||
const CommandOptionBase_1 = require("./CommandOptionBase");
|
|
||||||
const stringPredicate = ow_1.default.string.minLength(1).maxLength(100);
|
|
||||||
const integerPredicate = ow_1.default.number.finite;
|
|
||||||
// TODO: See resolution for sindresorhus/ow#217 in relation to this cast
|
|
||||||
const choicesPredicate = ow_1.default.array.ofType(ow_1.default.array.exactShape([stringPredicate, ow_1.default.any(ow_1.default.string, integerPredicate)]));
|
|
||||||
class ApplicationCommandOptionWithChoicesBase extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
Object.defineProperty(this, "choices", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Adds a choice for this option
|
|
||||||
* @param name The name of the choice
|
|
||||||
* @param value The value of the choice
|
|
||||||
*/
|
|
||||||
addChoice(name, value) {
|
|
||||||
this.choices ?? (this.choices = []);
|
|
||||||
Assertions_1.validateMaxChoicesLength(this.choices);
|
|
||||||
// Validate name
|
|
||||||
ow_1.default(name, `${ApplicationCommandOptionTypeNames[this.type]} choice name`, stringPredicate);
|
|
||||||
// Validate the value
|
|
||||||
if (this.type === 3 /* String */)
|
|
||||||
ow_1.default(value, 'string choice value', stringPredicate);
|
|
||||||
else
|
|
||||||
ow_1.default(value, `${ApplicationCommandOptionTypeNames[this.type]} choice value`, integerPredicate);
|
|
||||||
this.choices.push({ name, value });
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Adds multiple choices for this option
|
|
||||||
* @param choices The choices to add
|
|
||||||
*/
|
|
||||||
addChoices(choices) {
|
|
||||||
ow_1.default(choices, `${ApplicationCommandOptionTypeNames[this.type]} choices`, choicesPredicate);
|
|
||||||
for (const [label, value] of choices)
|
|
||||||
this.addChoice(label, value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
toJSON() {
|
|
||||||
return {
|
|
||||||
...super.toJSON(),
|
|
||||||
choices: this.choices,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.ApplicationCommandOptionWithChoicesBase = ApplicationCommandOptionWithChoicesBase;
|
|
||||||
const ApplicationCommandOptionTypeNames = {
|
|
||||||
[1 /* Subcommand */]: 'subcommand',
|
|
||||||
[2 /* SubcommandGroup */]: 'subcommand group',
|
|
||||||
[3 /* String */]: 'string',
|
|
||||||
[4 /* Integer */]: 'integer',
|
|
||||||
[5 /* Boolean */]: 'boolean',
|
|
||||||
[6 /* User */]: 'user',
|
|
||||||
[7 /* Channel */]: 'channel',
|
|
||||||
[8 /* Role */]: 'role',
|
|
||||||
[9 /* Mentionable */]: 'mentionable',
|
|
||||||
[10 /* Number */]: 'number',
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=CommandOptionWithChoices.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"CommandOptionWithChoices.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionWithChoices.ts"],"names":[],"mappings":";;;;AAAA,gCAAuG;AACvG,oDAAmC;AACnC,8CAAyD;AAEzD,2DAA6D;AAE7D,MAAM,eAAe,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC9D,MAAM,gBAAgB,GAAG,YAAE,CAAC,MAAM,CAAC,MAAM,CAAC;AAE1C,wEAAwE;AACxE,MAAM,gBAAgB,GAAG,YAAE,CAAC,KAAK,CAAC,MAAM,CACvC,YAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,YAAE,CAAC,GAAG,CAAC,YAAE,CAAC,MAAM,EAAE,gBAAgB,CAA0C,CAAC,CAAC,CACpH,CAAC;AAEF,MAAsB,uCACrB,SAAQ,0CAAsB;IAD/B;;QAIC;;;;;WAAqD;IAyCtD,CAAC;IAvCA;;;;OAIG;IACI,SAAS,CAAC,IAAY,EAAE,KAAQ;QACtC,IAAI,CAAC,OAAO,KAAZ,IAAI,CAAC,OAAO,GAAK,EAAE,EAAC;QAEpB,qCAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEvC,gBAAgB;QAChB,YAAE,CAAC,IAAI,EAAE,GAAG,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QAEzF,qBAAqB;QACrB,IAAI,IAAI,CAAC,IAAI,mBAAwC;YAAE,YAAE,CAAC,KAAK,EAAE,qBAAqB,EAAE,eAAe,CAAC,CAAC;;YACpG,YAAE,CAAC,KAAK,EAAE,GAAG,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAEjG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,OAAmC;QACpD,YAAE,CAAC,OAAO,EAAE,GAAG,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAEzF,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,OAAO;YAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACb,CAAC;IAEe,MAAM;QACrB,OAAO;YACN,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD;AA7CD,0FA6CC;AAED,MAAM,iCAAiC,GAAG;IACzC,oBAAyC,EAAE,YAAY;IACvD,yBAA8C,EAAE,kBAAkB;IAClE,gBAAqC,EAAE,QAAQ;IAC/C,iBAAsC,EAAE,SAAS;IACjD,iBAAsC,EAAE,SAAS;IACjD,cAAmC,EAAE,MAAM;IAC3C,iBAAsC,EAAE,SAAS;IACjD,cAAmC,EAAE,MAAM;IAC3C,qBAA0C,EAAE,aAAa;IACzD,iBAAqC,EAAE,QAAQ;CACtC,CAAC","sourcesContent":["import { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport ow, { Predicate } from 'ow';\nimport { validateMaxChoicesLength } from '../Assertions';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SlashCommandOptionBase } from './CommandOptionBase';\n\nconst stringPredicate = ow.string.minLength(1).maxLength(100);\nconst integerPredicate = ow.number.finite;\n\n// TODO: See resolution for sindresorhus/ow#217 in relation to this cast\nconst choicesPredicate = ow.array.ofType<[string, string | number]>(\n\tow.array.exactShape([stringPredicate, ow.any(ow.string, integerPredicate) as unknown as Predicate<string | number>]),\n);\n\nexport abstract class ApplicationCommandOptionWithChoicesBase<T extends string | number>\n\textends SlashCommandOptionBase\n\timplements ToAPIApplicationCommandOptions\n{\n\tpublic choices?: APIApplicationCommandOptionChoice[];\n\n\t/**\n\t * Adds a choice for this option\n\t * @param name The name of the choice\n\t * @param value The value of the choice\n\t */\n\tpublic addChoice(name: string, value: T) {\n\t\tthis.choices ??= [];\n\n\t\tvalidateMaxChoicesLength(this.choices);\n\n\t\t// Validate name\n\t\tow(name, `${ApplicationCommandOptionTypeNames[this.type]} choice name`, stringPredicate);\n\n\t\t// Validate the value\n\t\tif (this.type === ApplicationCommandOptionType.String) ow(value, 'string choice value', stringPredicate);\n\t\telse ow(value, `${ApplicationCommandOptionTypeNames[this.type]} choice value`, integerPredicate);\n\n\t\tthis.choices.push({ name, value });\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds multiple choices for this option\n\t * @param choices The choices to add\n\t */\n\tpublic addChoices(choices: [name: string, value: T][]) {\n\t\tow(choices, `${ApplicationCommandOptionTypeNames[this.type]} choices`, choicesPredicate);\n\n\t\tfor (const [label, value] of choices) this.addChoice(label, value);\n\t\treturn this;\n\t}\n\n\tpublic override toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\tchoices: this.choices,\n\t\t};\n\t}\n}\n\nconst ApplicationCommandOptionTypeNames = {\n\t[ApplicationCommandOptionType.Subcommand]: 'subcommand',\n\t[ApplicationCommandOptionType.SubcommandGroup]: 'subcommand group',\n\t[ApplicationCommandOptionType.String]: 'string',\n\t[ApplicationCommandOptionType.Integer]: 'integer',\n\t[ApplicationCommandOptionType.Boolean]: 'boolean',\n\t[ApplicationCommandOptionType.User]: 'user',\n\t[ApplicationCommandOptionType.Channel]: 'channel',\n\t[ApplicationCommandOptionType.Role]: 'role',\n\t[ApplicationCommandOptionType.Mentionable]: 'mentionable',\n\t[ApplicationCommandOptionType.Number]: 'number',\n} as const;\n"]}
|
|
||||||
Generated
Vendored
-54
@@ -1,54 +0,0 @@
|
|||||||
import { SlashCommandBooleanOption } from '../options/boolean';
|
|
||||||
import { SlashCommandChannelOption } from '../options/channel';
|
|
||||||
import { SlashCommandIntegerOption } from '../options/integer';
|
|
||||||
import { SlashCommandMentionableOption } from '../options/mentionable';
|
|
||||||
import { SlashCommandNumberOption } from '../options/number';
|
|
||||||
import { SlashCommandRoleOption } from '../options/role';
|
|
||||||
import { SlashCommandStringOption } from '../options/string';
|
|
||||||
import { SlashCommandUserOption } from '../options/user';
|
|
||||||
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
|
||||||
export declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
|
|
||||||
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, "addSubcommand" | "addSubcommandGroup"> : 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, "addSubcommand" | "addSubcommandGroup"> : 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, "addSubcommand" | "addSubcommandGroup"> : 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, "addSubcommand" | "addSubcommandGroup"> : 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, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
||||||
/**
|
|
||||||
* Adds a string option
|
|
||||||
* @param input A function that returns an option builder, or an already built builder
|
|
||||||
*/
|
|
||||||
addStringOption(input: SlashCommandStringOption | ((builder: SlashCommandStringOption) => SlashCommandStringOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
||||||
/**
|
|
||||||
* Adds an integer option
|
|
||||||
* @param input A function that returns an option builder, or an already built builder
|
|
||||||
*/
|
|
||||||
addIntegerOption(input: SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
||||||
/**
|
|
||||||
* Adds a number option
|
|
||||||
* @param input A function that returns an option builder, or an already built builder
|
|
||||||
*/
|
|
||||||
addNumberOption(input: SlashCommandNumberOption | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
||||||
private _sharedAddOptionMethod;
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=CommandOptions.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"CommandOptions.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAE7E,qBAAa,yBAAyB,CAAC,6BAA6B,GAAG,IAAI;IAC1E,SAAgB,OAAO,EAAG,8BAA8B,EAAE,CAAC;IAE3D;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,sBAAsB,CAAC;IAIlH;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,sBAAsB,CAAC;IAIlH;;;OAGG;IACI,oBAAoB,CAC1B,KAAK,EAAE,6BAA6B,GAAG,CAAC,CAAC,OAAO,EAAE,6BAA6B,KAAK,6BAA6B,CAAC;IAKnH;;;OAGG;IACI,eAAe,CACrB,KAAK,EAAE,wBAAwB,GAAG,CAAC,CAAC,OAAO,EAAE,wBAAwB,KAAK,wBAAwB,CAAC;IAKpG;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;OAGG;IACI,eAAe,CACrB,KAAK,EAAE,wBAAwB,GAAG,CAAC,CAAC,OAAO,EAAE,wBAAwB,KAAK,wBAAwB,CAAC;IAKpG,OAAO,CAAC,sBAAsB;CAmB9B"}
|
|
||||||
Generated
Vendored
-91
@@ -1,91 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SharedSlashCommandOptions = void 0;
|
|
||||||
const Assertions_1 = require("../Assertions");
|
|
||||||
const boolean_1 = require("../options/boolean");
|
|
||||||
const channel_1 = require("../options/channel");
|
|
||||||
const integer_1 = require("../options/integer");
|
|
||||||
const mentionable_1 = require("../options/mentionable");
|
|
||||||
const number_1 = require("../options/number");
|
|
||||||
const role_1 = require("../options/role");
|
|
||||||
const string_1 = require("../options/string");
|
|
||||||
const user_1 = require("../options/user");
|
|
||||||
class SharedSlashCommandOptions {
|
|
||||||
constructor() {
|
|
||||||
Object.defineProperty(this, "options", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Adds a boolean option
|
|
||||||
* @param input A function that returns an option builder, or an already built builder
|
|
||||||
*/
|
|
||||||
addBooleanOption(input) {
|
|
||||||
return this._sharedAddOptionMethod(input, boolean_1.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, user_1.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, channel_1.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, role_1.SlashCommandRoleOption);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Adds a mentionable option
|
|
||||||
* @param input A function that returns an option builder, or an already built builder
|
|
||||||
*/
|
|
||||||
addMentionableOption(input) {
|
|
||||||
return this._sharedAddOptionMethod(input, mentionable_1.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, string_1.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, integer_1.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, number_1.SlashCommandNumberOption);
|
|
||||||
}
|
|
||||||
_sharedAddOptionMethod(input, Instance) {
|
|
||||||
const { options } = this;
|
|
||||||
// First, assert options conditions - we cannot have more than 25 options
|
|
||||||
Assertions_1.validateMaxOptionsLength(options);
|
|
||||||
// Get the final result
|
|
||||||
const result = typeof input === 'function' ? input(new Instance()) : input;
|
|
||||||
Assertions_1.assertReturnOfBuilder(result, Instance);
|
|
||||||
// Push it
|
|
||||||
options.push(result);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SharedSlashCommandOptions = SharedSlashCommandOptions;
|
|
||||||
//# sourceMappingURL=CommandOptions.js.map
|
|
||||||
Generated
Vendored
-1
File diff suppressed because one or more lines are too long
Generated
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
export declare class SharedNameAndDescription {
|
|
||||||
readonly name: string;
|
|
||||||
readonly description: string;
|
|
||||||
/**
|
|
||||||
* Sets the name
|
|
||||||
* @param name The name
|
|
||||||
*/
|
|
||||||
setName(name: string): this;
|
|
||||||
/**
|
|
||||||
* Sets the description
|
|
||||||
* @param description The description
|
|
||||||
*/
|
|
||||||
setDescription(description: string): this;
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=NameAndDescription.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"NameAndDescription.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/NameAndDescription.ts"],"names":[],"mappings":"AAEA,qBAAa,wBAAwB;IACpC,SAAgB,IAAI,EAAG,MAAM,CAAC;IAC9B,SAAgB,WAAW,EAAG,MAAM,CAAC;IAErC;;;OAGG;IACI,OAAO,CAAC,IAAI,EAAE,MAAM;IAS3B;;;OAGG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM;CAQzC"}
|
|
||||||
Generated
Vendored
-42
@@ -1,42 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SharedNameAndDescription = void 0;
|
|
||||||
const Assertions_1 = require("../Assertions");
|
|
||||||
class SharedNameAndDescription {
|
|
||||||
constructor() {
|
|
||||||
Object.defineProperty(this, "name", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
Object.defineProperty(this, "description", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the name
|
|
||||||
* @param name The name
|
|
||||||
*/
|
|
||||||
setName(name) {
|
|
||||||
// Assert the name matches the conditions
|
|
||||||
Assertions_1.validateName(name);
|
|
||||||
Reflect.set(this, 'name', name);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the description
|
|
||||||
* @param description The description
|
|
||||||
*/
|
|
||||||
setDescription(description) {
|
|
||||||
// Assert the description matches the conditions
|
|
||||||
Assertions_1.validateDescription(description);
|
|
||||||
Reflect.set(this, 'description', description);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SharedNameAndDescription = SharedNameAndDescription;
|
|
||||||
//# sourceMappingURL=NameAndDescription.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"NameAndDescription.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/NameAndDescription.ts"],"names":[],"mappings":";;;AAAA,8CAAkE;AAElE,MAAa,wBAAwB;IAArC;QACC;;;;;WAA8B;QAC9B;;;;;WAAqC;IA2BtC,CAAC;IAzBA;;;OAGG;IACI,OAAO,CAAC,IAAY;QAC1B,yCAAyC;QACzC,yBAAY,CAAC,IAAI,CAAC,CAAC;QAEnB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEhC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,WAAmB;QACxC,gDAAgD;QAChD,gCAAmB,CAAC,WAAW,CAAC,CAAC;QAEjC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA7BD,4DA6BC","sourcesContent":["import { validateDescription, validateName } from '../Assertions';\n\nexport class SharedNameAndDescription {\n\tpublic readonly name!: string;\n\tpublic readonly description!: string;\n\n\t/**\n\t * Sets the name\n\t * @param name The name\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 description\n\t * @param description The description\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"]}
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { SlashCommandOptionBase } from '../mixins/CommandOptionBase';
|
|
||||||
export declare class SlashCommandBooleanOption extends SlashCommandOptionBase {
|
|
||||||
readonly type: ApplicationCommandOptionType.Boolean;
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=boolean.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"boolean.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,qBAAa,yBAA0B,SAAQ,sBAAsB;IACpE,SAAyB,IAAI,uCAAiD;;CAK9E"}
|
|
||||||
Generated
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandBooleanOption = void 0;
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const CommandOptionBase_1 = require("../mixins/CommandOptionBase");
|
|
||||||
class SlashCommandBooleanOption extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
||||||
constructor() {
|
|
||||||
super(5 /* Boolean */);
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: 5 /* Boolean */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandBooleanOption = SlashCommandBooleanOption;
|
|
||||||
//# sourceMappingURL=boolean.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"boolean.js","sourceRoot":"/","sources":["interactions/slashCommands/options/boolean.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,mEAAqE;AAErE,MAAa,yBAA0B,SAAQ,0CAAsB;IAGpE;QACC,KAAK,iBAAsC,CAAC;QAH7C;;;;mBAAgC,eAA6C;WAAC;IAI9E,CAAC;CACD;AAND,8DAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { SlashCommandOptionBase } from '../mixins/CommandOptionBase';\n\nexport class SlashCommandBooleanOption extends SlashCommandOptionBase {\n\tpublic override readonly type = ApplicationCommandOptionType.Boolean as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.Boolean);\n\t}\n}\n"]}
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { SlashCommandOptionBase } from '../mixins/CommandOptionBase';
|
|
||||||
export declare class SlashCommandChannelOption extends SlashCommandOptionBase {
|
|
||||||
readonly type: ApplicationCommandOptionType.Channel;
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=channel.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"channel.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,qBAAa,yBAA0B,SAAQ,sBAAsB;IACpE,SAAyB,IAAI,uCAAiD;;CAK9E"}
|
|
||||||
Generated
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandChannelOption = void 0;
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const CommandOptionBase_1 = require("../mixins/CommandOptionBase");
|
|
||||||
class SlashCommandChannelOption extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
||||||
constructor() {
|
|
||||||
super(7 /* Channel */);
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: 7 /* Channel */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandChannelOption = SlashCommandChannelOption;
|
|
||||||
//# sourceMappingURL=channel.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"channel.js","sourceRoot":"/","sources":["interactions/slashCommands/options/channel.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,mEAAqE;AAErE,MAAa,yBAA0B,SAAQ,0CAAsB;IAGpE;QACC,KAAK,iBAAsC,CAAC;QAH7C;;;;mBAAgC,eAA6C;WAAC;IAI9E,CAAC;CACD;AAND,8DAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { SlashCommandOptionBase } from '../mixins/CommandOptionBase';\n\nexport class SlashCommandChannelOption extends SlashCommandOptionBase {\n\tpublic override readonly type = ApplicationCommandOptionType.Channel as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.Channel);\n\t}\n}\n"]}
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { ApplicationCommandOptionWithChoicesBase } from '../mixins/CommandOptionWithChoices';
|
|
||||||
export declare class SlashCommandIntegerOption extends ApplicationCommandOptionWithChoicesBase<number> {
|
|
||||||
readonly type: ApplicationCommandOptionType.Integer;
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=integer.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"integer.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/integer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAC;AAE7F,qBAAa,yBAA0B,SAAQ,uCAAuC,CAAC,MAAM,CAAC;IAC7F,SAAyB,IAAI,uCAAiD;;CAK9E"}
|
|
||||||
Generated
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandIntegerOption = void 0;
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const CommandOptionWithChoices_1 = require("../mixins/CommandOptionWithChoices");
|
|
||||||
class SlashCommandIntegerOption extends CommandOptionWithChoices_1.ApplicationCommandOptionWithChoicesBase {
|
|
||||||
constructor() {
|
|
||||||
super(4 /* Integer */);
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: 4 /* Integer */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandIntegerOption = SlashCommandIntegerOption;
|
|
||||||
//# sourceMappingURL=integer.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"integer.js","sourceRoot":"/","sources":["interactions/slashCommands/options/integer.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,iFAA6F;AAE7F,MAAa,yBAA0B,SAAQ,kEAA+C;IAG7F;QACC,KAAK,iBAAsC,CAAC;QAH7C;;;;mBAAgC,eAA6C;WAAC;IAI9E,CAAC;CACD;AAND,8DAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { ApplicationCommandOptionWithChoicesBase } from '../mixins/CommandOptionWithChoices';\n\nexport class SlashCommandIntegerOption extends ApplicationCommandOptionWithChoicesBase<number> {\n\tpublic override readonly type = ApplicationCommandOptionType.Integer as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.Integer);\n\t}\n}\n"]}
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { SlashCommandOptionBase } from '../mixins/CommandOptionBase';
|
|
||||||
export declare class SlashCommandMentionableOption extends SlashCommandOptionBase {
|
|
||||||
readonly type: ApplicationCommandOptionType.Mentionable;
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=mentionable.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"mentionable.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/mentionable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,qBAAa,6BAA8B,SAAQ,sBAAsB;IACxE,SAAyB,IAAI,2CAAqD;;CAKlF"}
|
|
||||||
Generated
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandMentionableOption = void 0;
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const CommandOptionBase_1 = require("../mixins/CommandOptionBase");
|
|
||||||
class SlashCommandMentionableOption extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
||||||
constructor() {
|
|
||||||
super(9 /* Mentionable */);
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: 9 /* Mentionable */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandMentionableOption = SlashCommandMentionableOption;
|
|
||||||
//# sourceMappingURL=mentionable.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"mentionable.js","sourceRoot":"/","sources":["interactions/slashCommands/options/mentionable.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,mEAAqE;AAErE,MAAa,6BAA8B,SAAQ,0CAAsB;IAGxE;QACC,KAAK,qBAA0C,CAAC;QAHjD;;;;mBAAgC,mBAAiD;WAAC;IAIlF,CAAC;CACD;AAND,sEAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { SlashCommandOptionBase } from '../mixins/CommandOptionBase';\n\nexport class SlashCommandMentionableOption extends SlashCommandOptionBase {\n\tpublic override readonly type = ApplicationCommandOptionType.Mentionable as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.Mentionable);\n\t}\n}\n"]}
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { ApplicationCommandOptionWithChoicesBase } from '../mixins/CommandOptionWithChoices';
|
|
||||||
export declare class SlashCommandNumberOption extends ApplicationCommandOptionWithChoicesBase<number> {
|
|
||||||
readonly type: ApplicationCommandOptionType.Number;
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=number.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"number.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAC;AAE7F,qBAAa,wBAAyB,SAAQ,uCAAuC,CAAC,MAAM,CAAC;IAC5F,SAAyB,IAAI,sCAAgD;;CAK7E"}
|
|
||||||
Generated
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandNumberOption = void 0;
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const CommandOptionWithChoices_1 = require("../mixins/CommandOptionWithChoices");
|
|
||||||
class SlashCommandNumberOption extends CommandOptionWithChoices_1.ApplicationCommandOptionWithChoicesBase {
|
|
||||||
constructor() {
|
|
||||||
super(10 /* Number */);
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: 10 /* Number */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandNumberOption = SlashCommandNumberOption;
|
|
||||||
//# sourceMappingURL=number.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"number.js","sourceRoot":"/","sources":["interactions/slashCommands/options/number.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,iFAA6F;AAE7F,MAAa,wBAAyB,SAAQ,kEAA+C;IAG5F;QACC,KAAK,iBAAqC,CAAC;QAH5C;;;;mBAAgC,eAA4C;WAAC;IAI7E,CAAC;CACD;AAND,4DAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { ApplicationCommandOptionWithChoicesBase } from '../mixins/CommandOptionWithChoices';\n\nexport class SlashCommandNumberOption extends ApplicationCommandOptionWithChoicesBase<number> {\n\tpublic override readonly type = ApplicationCommandOptionType.Number as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.Number);\n\t}\n}\n"]}
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { SlashCommandOptionBase } from '../mixins/CommandOptionBase';
|
|
||||||
export declare class SlashCommandRoleOption extends SlashCommandOptionBase {
|
|
||||||
readonly type: ApplicationCommandOptionType.Role;
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=role.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"role.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/role.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,qBAAa,sBAAuB,SAAQ,sBAAsB;IACjE,SAAyB,IAAI,oCAA8C;;CAK3E"}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandRoleOption = void 0;
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const CommandOptionBase_1 = require("../mixins/CommandOptionBase");
|
|
||||||
class SlashCommandRoleOption extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
||||||
constructor() {
|
|
||||||
super(8 /* Role */);
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: 8 /* Role */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandRoleOption = SlashCommandRoleOption;
|
|
||||||
//# sourceMappingURL=role.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"role.js","sourceRoot":"/","sources":["interactions/slashCommands/options/role.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,mEAAqE;AAErE,MAAa,sBAAuB,SAAQ,0CAAsB;IAGjE;QACC,KAAK,cAAmC,CAAC;QAH1C;;;;mBAAgC,YAA0C;WAAC;IAI3E,CAAC;CACD;AAND,wDAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { SlashCommandOptionBase } from '../mixins/CommandOptionBase';\n\nexport class SlashCommandRoleOption extends SlashCommandOptionBase {\n\tpublic override readonly type = ApplicationCommandOptionType.Role as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.Role);\n\t}\n}\n"]}
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { ApplicationCommandOptionWithChoicesBase } from '../mixins/CommandOptionWithChoices';
|
|
||||||
export declare class SlashCommandStringOption extends ApplicationCommandOptionWithChoicesBase<string> {
|
|
||||||
readonly type: ApplicationCommandOptionType.String;
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=string.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"string.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAC;AAE7F,qBAAa,wBAAyB,SAAQ,uCAAuC,CAAC,MAAM,CAAC;IAC5F,SAAyB,IAAI,sCAAgD;;CAK7E"}
|
|
||||||
Generated
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandStringOption = void 0;
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const CommandOptionWithChoices_1 = require("../mixins/CommandOptionWithChoices");
|
|
||||||
class SlashCommandStringOption extends CommandOptionWithChoices_1.ApplicationCommandOptionWithChoicesBase {
|
|
||||||
constructor() {
|
|
||||||
super(3 /* String */);
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: 3 /* String */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandStringOption = SlashCommandStringOption;
|
|
||||||
//# sourceMappingURL=string.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"string.js","sourceRoot":"/","sources":["interactions/slashCommands/options/string.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,iFAA6F;AAE7F,MAAa,wBAAyB,SAAQ,kEAA+C;IAG5F;QACC,KAAK,gBAAqC,CAAC;QAH5C;;;;mBAAgC,cAA4C;WAAC;IAI7E,CAAC;CACD;AAND,4DAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { ApplicationCommandOptionWithChoicesBase } from '../mixins/CommandOptionWithChoices';\n\nexport class SlashCommandStringOption extends ApplicationCommandOptionWithChoicesBase<string> {\n\tpublic override readonly type = ApplicationCommandOptionType.String as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.String);\n\t}\n}\n"]}
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
|
||||||
import { SlashCommandOptionBase } from '../mixins/CommandOptionBase';
|
|
||||||
export declare class SlashCommandUserOption extends SlashCommandOptionBase {
|
|
||||||
readonly type: ApplicationCommandOptionType.User;
|
|
||||||
constructor();
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=user.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"user.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/options/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,qBAAa,sBAAuB,SAAQ,sBAAsB;IACjE,SAAyB,IAAI,oCAA8C;;CAK3E"}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SlashCommandUserOption = void 0;
|
|
||||||
require("discord-api-types/v9");
|
|
||||||
const CommandOptionBase_1 = require("../mixins/CommandOptionBase");
|
|
||||||
class SlashCommandUserOption extends CommandOptionBase_1.SlashCommandOptionBase {
|
|
||||||
constructor() {
|
|
||||||
super(6 /* User */);
|
|
||||||
Object.defineProperty(this, "type", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: 6 /* User */
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.SlashCommandUserOption = SlashCommandUserOption;
|
|
||||||
//# sourceMappingURL=user.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"user.js","sourceRoot":"/","sources":["interactions/slashCommands/options/user.ts"],"names":[],"mappings":";;;AAAA,gCAAoE;AACpE,mEAAqE;AAErE,MAAa,sBAAuB,SAAQ,0CAAsB;IAGjE;QACC,KAAK,cAAmC,CAAC;QAH1C;;;;mBAAgC,YAA0C;WAAC;IAI3E,CAAC;CACD;AAND,wDAMC","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { SlashCommandOptionBase } from '../mixins/CommandOptionBase';\n\nexport class SlashCommandUserOption extends SlashCommandOptionBase {\n\tpublic override readonly type = ApplicationCommandOptionType.User as const;\n\n\tpublic constructor() {\n\t\tsuper(ApplicationCommandOptionType.User);\n\t}\n}\n"]}
|
|
||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
import type { APIEmbedField } from 'discord-api-types/v9';
|
|
||||||
export declare const fieldNamePredicate: import("ow").StringPredicate;
|
|
||||||
export declare const fieldValuePredicate: import("ow").StringPredicate;
|
|
||||||
export declare const fieldInlinePredicate: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
|
|
||||||
export declare const embedFieldPredicate: import("ow").ObjectPredicate<{
|
|
||||||
name: string;
|
|
||||||
value: string;
|
|
||||||
inline: boolean | undefined;
|
|
||||||
}>;
|
|
||||||
export declare const embedFieldsArrayPredicate: import("ow").ArrayPredicate<{
|
|
||||||
name: string;
|
|
||||||
value: string;
|
|
||||||
inline: boolean | undefined;
|
|
||||||
}>;
|
|
||||||
export declare function validateFieldLength(fields: APIEmbedField[], amountAdding: number): void;
|
|
||||||
export declare const authorNamePredicate: import("ow").AnyPredicate<string | null>;
|
|
||||||
export declare const urlPredicate: import("ow").AnyPredicate<string | null | undefined>;
|
|
||||||
export declare const colorPredicate: import("ow").AnyPredicate<number | null>;
|
|
||||||
export declare const descriptionPredicate: import("ow").AnyPredicate<string | null>;
|
|
||||||
export declare const footerTextPredicate: import("ow").AnyPredicate<string | null>;
|
|
||||||
export declare const timestampPredicate: import("ow").AnyPredicate<number | Date | null>;
|
|
||||||
export declare const titlePredicate: import("ow").AnyPredicate<string | null>;
|
|
||||||
//# sourceMappingURL=Assertions.d.ts.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"Assertions.d.ts","sourceRoot":"/","sources":["messages/embed/Assertions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,eAAO,MAAM,kBAAkB,8BAAwC,CAAC;AAExE,eAAO,MAAM,mBAAmB,8BAAyC,CAAC;AAE1E,eAAO,MAAM,oBAAoB,iFAAsB,CAAC;AAExD,eAAO,MAAM,mBAAmB;;;;EAI9B,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;EAAuC,CAAC;AAE9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAEvF;AAED,eAAO,MAAM,mBAAmB,0CAAsC,CAAC;AAEvE,eAAO,MAAM,YAAY,sDAA4C,CAAC;AAEtE,eAAO,MAAM,cAAc,0CAA6E,CAAC;AAEzG,eAAO,MAAM,oBAAoB,0CAA0D,CAAC;AAE5F,eAAO,MAAM,mBAAmB,0CAA0D,CAAC;AAE3F,eAAO,MAAM,kBAAkB,iDAAsC,CAAC;AAEtE,eAAO,MAAM,cAAc,0CAAsC,CAAC"}
|
|
||||||
-26
@@ -1,26 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.titlePredicate = exports.timestampPredicate = exports.footerTextPredicate = exports.descriptionPredicate = exports.colorPredicate = exports.urlPredicate = exports.authorNamePredicate = exports.validateFieldLength = exports.embedFieldsArrayPredicate = exports.embedFieldPredicate = exports.fieldInlinePredicate = exports.fieldValuePredicate = exports.fieldNamePredicate = void 0;
|
|
||||||
const tslib_1 = require("tslib");
|
|
||||||
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
||||||
exports.fieldNamePredicate = ow_1.default.string.minLength(1).maxLength(256);
|
|
||||||
exports.fieldValuePredicate = ow_1.default.string.minLength(1).maxLength(1024);
|
|
||||||
exports.fieldInlinePredicate = ow_1.default.optional.boolean;
|
|
||||||
exports.embedFieldPredicate = ow_1.default.object.exactShape({
|
|
||||||
name: exports.fieldNamePredicate,
|
|
||||||
value: exports.fieldValuePredicate,
|
|
||||||
inline: exports.fieldInlinePredicate,
|
|
||||||
});
|
|
||||||
exports.embedFieldsArrayPredicate = ow_1.default.array.ofType(exports.embedFieldPredicate);
|
|
||||||
function validateFieldLength(fields, amountAdding) {
|
|
||||||
ow_1.default(fields.length + amountAdding, 'field amount', ow_1.default.number.lessThanOrEqual(25));
|
|
||||||
}
|
|
||||||
exports.validateFieldLength = validateFieldLength;
|
|
||||||
exports.authorNamePredicate = ow_1.default.any(exports.fieldNamePredicate, ow_1.default.null);
|
|
||||||
exports.urlPredicate = ow_1.default.any(ow_1.default.string.url, ow_1.default.nullOrUndefined);
|
|
||||||
exports.colorPredicate = ow_1.default.any(ow_1.default.number.greaterThanOrEqual(0).lessThanOrEqual(0xffffff), ow_1.default.null);
|
|
||||||
exports.descriptionPredicate = ow_1.default.any(ow_1.default.string.minLength(1).maxLength(4096), ow_1.default.null);
|
|
||||||
exports.footerTextPredicate = ow_1.default.any(ow_1.default.string.minLength(1).maxLength(2048), ow_1.default.null);
|
|
||||||
exports.timestampPredicate = ow_1.default.any(ow_1.default.number, ow_1.default.date, ow_1.default.null);
|
|
||||||
exports.titlePredicate = ow_1.default.any(exports.fieldNamePredicate, ow_1.default.null);
|
|
||||||
//# sourceMappingURL=Assertions.js.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"Assertions.js","sourceRoot":"/","sources":["messages/embed/Assertions.ts"],"names":[],"mappings":";;;;AACA,oDAAoB;AAEP,QAAA,kBAAkB,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAE3D,QAAA,mBAAmB,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAE7D,QAAA,oBAAoB,GAAG,YAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;AAE3C,QAAA,mBAAmB,GAAG,YAAE,CAAC,MAAM,CAAC,UAAU,CAAC;IACvD,IAAI,EAAE,0BAAkB;IACxB,KAAK,EAAE,2BAAmB;IAC1B,MAAM,EAAE,4BAAoB;CAC5B,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,YAAE,CAAC,KAAK,CAAC,MAAM,CAAC,2BAAmB,CAAC,CAAC;AAE9E,SAAgB,mBAAmB,CAAC,MAAuB,EAAE,YAAoB;IAChF,YAAE,CAAC,MAAM,CAAC,MAAM,GAAG,YAAY,EAAE,cAAc,EAAE,YAAE,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;AACjF,CAAC;AAFD,kDAEC;AAEY,QAAA,mBAAmB,GAAG,YAAE,CAAC,GAAG,CAAC,0BAAkB,EAAE,YAAE,CAAC,IAAI,CAAC,CAAC;AAE1D,QAAA,YAAY,GAAG,YAAE,CAAC,GAAG,CAAC,YAAE,CAAC,MAAM,CAAC,GAAG,EAAE,YAAE,CAAC,eAAe,CAAC,CAAC;AAEzD,QAAA,cAAc,GAAG,YAAE,CAAC,GAAG,CAAC,YAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,YAAE,CAAC,IAAI,CAAC,CAAC;AAE5F,QAAA,oBAAoB,GAAG,YAAE,CAAC,GAAG,CAAC,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,YAAE,CAAC,IAAI,CAAC,CAAC;AAE/E,QAAA,mBAAmB,GAAG,YAAE,CAAC,GAAG,CAAC,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,YAAE,CAAC,IAAI,CAAC,CAAC;AAE9E,QAAA,kBAAkB,GAAG,YAAE,CAAC,GAAG,CAAC,YAAE,CAAC,MAAM,EAAE,YAAE,CAAC,IAAI,EAAE,YAAE,CAAC,IAAI,CAAC,CAAC;AAEzD,QAAA,cAAc,GAAG,YAAE,CAAC,GAAG,CAAC,0BAAkB,EAAE,YAAE,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { APIEmbedField } from 'discord-api-types/v9';\nimport ow from 'ow';\n\nexport const fieldNamePredicate = ow.string.minLength(1).maxLength(256);\n\nexport const fieldValuePredicate = ow.string.minLength(1).maxLength(1024);\n\nexport const fieldInlinePredicate = ow.optional.boolean;\n\nexport const embedFieldPredicate = ow.object.exactShape({\n\tname: fieldNamePredicate,\n\tvalue: fieldValuePredicate,\n\tinline: fieldInlinePredicate,\n});\n\nexport const embedFieldsArrayPredicate = ow.array.ofType(embedFieldPredicate);\n\nexport function validateFieldLength(fields: APIEmbedField[], amountAdding: number): void {\n\tow(fields.length + amountAdding, 'field amount', ow.number.lessThanOrEqual(25));\n}\n\nexport const authorNamePredicate = ow.any(fieldNamePredicate, ow.null);\n\nexport const urlPredicate = ow.any(ow.string.url, ow.nullOrUndefined);\n\nexport const colorPredicate = ow.any(ow.number.greaterThanOrEqual(0).lessThanOrEqual(0xffffff), ow.null);\n\nexport const descriptionPredicate = ow.any(ow.string.minLength(1).maxLength(4096), ow.null);\n\nexport const footerTextPredicate = ow.any(ow.string.minLength(1).maxLength(2048), ow.null);\n\nexport const timestampPredicate = ow.any(ow.number, ow.date, ow.null);\n\nexport const titlePredicate = ow.any(fieldNamePredicate, ow.null);\n"]}
|
|
||||||
-140
@@ -1,140 +0,0 @@
|
|||||||
import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage, APIEmbedProvider, APIEmbedThumbnail, APIEmbedVideo } from 'discord-api-types/v9';
|
|
||||||
export interface AuthorOptions {
|
|
||||||
name: string;
|
|
||||||
url?: string;
|
|
||||||
iconURL?: string;
|
|
||||||
}
|
|
||||||
export interface FooterOptions {
|
|
||||||
text: string;
|
|
||||||
iconURL?: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
|
||||||
*/
|
|
||||||
export declare class Embed implements APIEmbed {
|
|
||||||
/**
|
|
||||||
* An array of fields of this embed.
|
|
||||||
*/
|
|
||||||
fields: APIEmbedField[];
|
|
||||||
/**
|
|
||||||
* The embed title.
|
|
||||||
*/
|
|
||||||
title?: string;
|
|
||||||
/**
|
|
||||||
* The embed description.
|
|
||||||
*/
|
|
||||||
description?: string;
|
|
||||||
/**
|
|
||||||
* The embed url.
|
|
||||||
*/
|
|
||||||
url?: string;
|
|
||||||
/**
|
|
||||||
* The embed color.
|
|
||||||
*/
|
|
||||||
color?: number;
|
|
||||||
/**
|
|
||||||
* The timestamp of the embed in the ISO format.
|
|
||||||
*/
|
|
||||||
timestamp?: string;
|
|
||||||
/**
|
|
||||||
* The embed thumbnail data.
|
|
||||||
*/
|
|
||||||
thumbnail?: APIEmbedThumbnail;
|
|
||||||
/**
|
|
||||||
* The embed image data.
|
|
||||||
*/
|
|
||||||
image?: APIEmbedImage;
|
|
||||||
/**
|
|
||||||
* Received video data.
|
|
||||||
*/
|
|
||||||
video?: APIEmbedVideo;
|
|
||||||
/**
|
|
||||||
* The embed author data.
|
|
||||||
*/
|
|
||||||
author?: APIEmbedAuthor;
|
|
||||||
/**
|
|
||||||
* Received data about the embed provider.
|
|
||||||
*/
|
|
||||||
provider?: APIEmbedProvider;
|
|
||||||
/**
|
|
||||||
* The embed footer data.
|
|
||||||
*/
|
|
||||||
footer?: APIEmbedFooter;
|
|
||||||
constructor(data?: APIEmbed);
|
|
||||||
/**
|
|
||||||
* The accumulated length for the embed title, description, fields, footer text, and author name.
|
|
||||||
*/
|
|
||||||
get length(): number;
|
|
||||||
/**
|
|
||||||
* Adds a field to the embed (max 25).
|
|
||||||
* @param field The field to add.
|
|
||||||
*/
|
|
||||||
addField(field: APIEmbedField): this;
|
|
||||||
/**
|
|
||||||
* Adds fields to the embed (max 25).
|
|
||||||
* @param fields The fields to add.
|
|
||||||
*/
|
|
||||||
addFields(...fields: APIEmbedField[]): this;
|
|
||||||
/**
|
|
||||||
* Removes, replaces, or inserts fields in the embed (max 25).
|
|
||||||
* @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 author of this embed.
|
|
||||||
* @param options The options for the author.
|
|
||||||
*/
|
|
||||||
setAuthor(options: AuthorOptions | null): this;
|
|
||||||
/**
|
|
||||||
* Sets the color of this embed.
|
|
||||||
* @param color The color of the embed.
|
|
||||||
*/
|
|
||||||
setColor(color: number | null): this;
|
|
||||||
/**
|
|
||||||
* Sets the description of this embed.
|
|
||||||
* @param description The description.
|
|
||||||
*/
|
|
||||||
setDescription(description: string | null): this;
|
|
||||||
/**
|
|
||||||
* Sets the footer of this embed.
|
|
||||||
* @param options The options for the footer.
|
|
||||||
*/
|
|
||||||
setFooter(options: FooterOptions | null): this;
|
|
||||||
/**
|
|
||||||
* Sets the image of this embed.
|
|
||||||
* @param url The URL of the image.
|
|
||||||
*/
|
|
||||||
setImage(url: string | null): this;
|
|
||||||
/**
|
|
||||||
* Sets the thumbnail of this embed.
|
|
||||||
* @param url The URL of the thumbnail.
|
|
||||||
*/
|
|
||||||
setThumbnail(url: string | null): this;
|
|
||||||
/**
|
|
||||||
* Sets the timestamp of this embed.
|
|
||||||
* @param timestamp The timestamp or date.
|
|
||||||
*/
|
|
||||||
setTimestamp(timestamp?: number | Date | null): this;
|
|
||||||
/**
|
|
||||||
* Sets the title of this embed.
|
|
||||||
* @param title The title.
|
|
||||||
*/
|
|
||||||
setTitle(title: string | null): this;
|
|
||||||
/**
|
|
||||||
* Sets the URL of this embed.
|
|
||||||
* @param url The URL.
|
|
||||||
*/
|
|
||||||
setURL(url: string | null): this;
|
|
||||||
/**
|
|
||||||
* Transforms the embed to a plain object.
|
|
||||||
*/
|
|
||||||
toJSON(): APIEmbed;
|
|
||||||
/**
|
|
||||||
* Normalizes field input and resolves strings.
|
|
||||||
* @param fields Fields to normalize.
|
|
||||||
*/
|
|
||||||
static normalizeFields(...fields: APIEmbedField[]): APIEmbedField[];
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=Embed.d.ts.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"Embed.d.ts","sourceRoot":"/","sources":["messages/embed/Embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,MAAM,sBAAsB,CAAC;AAiB9B,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,KAAM,YAAW,QAAQ;IACrC;;OAEG;IACI,MAAM,EAAE,aAAa,EAAE,CAAC;IAE/B;;OAEG;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACI,WAAW,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACI,GAAG,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACI,SAAS,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACI,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAErC;;OAEG;IACI,KAAK,CAAC,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACI,KAAK,CAAC,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACI,MAAM,CAAC,EAAE,cAAc,CAAC;IAE/B;;OAEG;IACI,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAEnC;;OAEG;IACI,MAAM,CAAC,EAAE,cAAc,CAAC;gBAEZ,IAAI,GAAE,QAAa;IAgBtC;;OAEG;IACH,IAAW,MAAM,IAAI,MAAM,CAQ1B;IAED;;;OAGG;IACI,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAI3C;;;OAGG;IACI,SAAS,CAAC,GAAG,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI;IAWlD;;;;;OAKG;IACI,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI;IAWzF;;;OAGG;IACI,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI;IAgBrD;;;OAGG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQ3C;;;OAGG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQvD;;;OAGG;IACI,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI;IAerD;;;OAGG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQzC;;;OAGG;IACI,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQ7C;;;OAGG;IACI,YAAY,CAAC,SAAS,GAAE,MAAM,GAAG,IAAI,GAAG,IAAiB,GAAG,IAAI;IAQvE;;;OAGG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQ3C;;;OAGG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQvC;;OAEG;IACI,MAAM,IAAI,QAAQ;IAIzB;;;OAGG;WACW,eAAe,CAAC,GAAG,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE;CAS1E"}
|
|
||||||
-300
@@ -1,300 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.Embed = void 0;
|
|
||||||
const tslib_1 = require("tslib");
|
|
||||||
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
||||||
const Assertions_1 = require("./Assertions");
|
|
||||||
/**
|
|
||||||
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
|
||||||
*/
|
|
||||||
class Embed {
|
|
||||||
constructor(data = {}) {
|
|
||||||
/**
|
|
||||||
* An array of fields of this embed.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "fields", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The embed title.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "title", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The embed description.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "description", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The embed url.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "url", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The embed color.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "color", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The timestamp of the embed in the ISO format.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "timestamp", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The embed thumbnail data.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "thumbnail", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The embed image data.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "image", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* Received video data.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "video", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The embed author data.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "author", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* Received data about the embed provider.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "provider", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* The embed footer data.
|
|
||||||
*/
|
|
||||||
Object.defineProperty(this, "footer", {
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
value: void 0
|
|
||||||
});
|
|
||||||
this.title = data.title;
|
|
||||||
this.description = data.description;
|
|
||||||
this.url = data.url;
|
|
||||||
this.color = data.color;
|
|
||||||
this.thumbnail = data.thumbnail;
|
|
||||||
this.image = data.image;
|
|
||||||
this.video = data.video;
|
|
||||||
this.author = data.author;
|
|
||||||
this.provider = data.provider;
|
|
||||||
this.footer = data.footer;
|
|
||||||
this.fields = data.fields ?? [];
|
|
||||||
if (data.timestamp)
|
|
||||||
this.timestamp = new Date(data.timestamp).toISOString();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The accumulated length for the embed title, description, fields, footer text, and author name.
|
|
||||||
*/
|
|
||||||
get length() {
|
|
||||||
return ((this.title?.length ?? 0) +
|
|
||||||
(this.description?.length ?? 0) +
|
|
||||||
this.fields.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) +
|
|
||||||
(this.footer?.text.length ?? 0) +
|
|
||||||
(this.author?.name?.length ?? 0));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Adds a field to the embed (max 25).
|
|
||||||
* @param field The field to add.
|
|
||||||
*/
|
|
||||||
addField(field) {
|
|
||||||
return this.addFields(field);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Adds fields to the embed (max 25).
|
|
||||||
* @param fields The fields to add.
|
|
||||||
*/
|
|
||||||
addFields(...fields) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(fields, 'fields', Assertions_1.embedFieldsArrayPredicate);
|
|
||||||
// Ensure adding these fields won't exceed the 25 field limit
|
|
||||||
Assertions_1.validateFieldLength(this.fields, fields.length);
|
|
||||||
this.fields.push(...Embed.normalizeFields(...fields));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Removes, replaces, or inserts fields in the embed (max 25).
|
|
||||||
* @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) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(fields, 'fields', Assertions_1.embedFieldsArrayPredicate);
|
|
||||||
// Ensure adding these fields won't exceed the 25 field limit
|
|
||||||
Assertions_1.validateFieldLength(this.fields, fields.length - deleteCount);
|
|
||||||
this.fields.splice(index, deleteCount, ...Embed.normalizeFields(...fields));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the author of this embed.
|
|
||||||
* @param options The options for the author.
|
|
||||||
*/
|
|
||||||
setAuthor(options) {
|
|
||||||
if (options === null) {
|
|
||||||
this.author = undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
const { name, iconURL, url } = options;
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(name, 'name', Assertions_1.authorNamePredicate);
|
|
||||||
ow_1.default(iconURL, 'iconURL', Assertions_1.urlPredicate);
|
|
||||||
ow_1.default(url, 'url', Assertions_1.urlPredicate);
|
|
||||||
this.author = { name, url, icon_url: iconURL };
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the color of this embed.
|
|
||||||
* @param color The color of the embed.
|
|
||||||
*/
|
|
||||||
setColor(color) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(color, 'color', Assertions_1.colorPredicate);
|
|
||||||
this.color = color ?? undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the description of this embed.
|
|
||||||
* @param description The description.
|
|
||||||
*/
|
|
||||||
setDescription(description) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(description, 'description', Assertions_1.descriptionPredicate);
|
|
||||||
this.description = description ?? undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the footer of this embed.
|
|
||||||
* @param options The options for the footer.
|
|
||||||
*/
|
|
||||||
setFooter(options) {
|
|
||||||
if (options === null) {
|
|
||||||
this.footer = undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
const { text, iconURL } = options;
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(text, 'text', Assertions_1.footerTextPredicate);
|
|
||||||
ow_1.default(iconURL, 'iconURL', Assertions_1.urlPredicate);
|
|
||||||
this.footer = { text, icon_url: iconURL };
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the image of this embed.
|
|
||||||
* @param url The URL of the image.
|
|
||||||
*/
|
|
||||||
setImage(url) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(url, 'url', Assertions_1.urlPredicate);
|
|
||||||
this.image = url ? { url } : undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the thumbnail of this embed.
|
|
||||||
* @param url The URL of the thumbnail.
|
|
||||||
*/
|
|
||||||
setThumbnail(url) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(url, 'url', Assertions_1.urlPredicate);
|
|
||||||
this.thumbnail = url ? { url } : undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the timestamp of this embed.
|
|
||||||
* @param timestamp The timestamp or date.
|
|
||||||
*/
|
|
||||||
setTimestamp(timestamp = Date.now()) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(timestamp, 'timestamp', Assertions_1.timestampPredicate);
|
|
||||||
this.timestamp = timestamp ? new Date(timestamp).toISOString() : undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the title of this embed.
|
|
||||||
* @param title The title.
|
|
||||||
*/
|
|
||||||
setTitle(title) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(title, 'title', Assertions_1.titlePredicate);
|
|
||||||
this.title = title ?? undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets the URL of this embed.
|
|
||||||
* @param url The URL.
|
|
||||||
*/
|
|
||||||
setURL(url) {
|
|
||||||
// Data assertions
|
|
||||||
ow_1.default(url, 'url', Assertions_1.urlPredicate);
|
|
||||||
this.url = url ?? undefined;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Transforms the embed to a plain object.
|
|
||||||
*/
|
|
||||||
toJSON() {
|
|
||||||
return { ...this };
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Normalizes field input and resolves strings.
|
|
||||||
* @param fields Fields to normalize.
|
|
||||||
*/
|
|
||||||
static normalizeFields(...fields) {
|
|
||||||
return fields.flat(Infinity).map((field) => {
|
|
||||||
ow_1.default(field.name, 'field name', Assertions_1.fieldNamePredicate);
|
|
||||||
ow_1.default(field.value, 'field value', Assertions_1.fieldValuePredicate);
|
|
||||||
ow_1.default(field.inline, 'field inline', Assertions_1.fieldInlinePredicate);
|
|
||||||
return { name: field.name, value: field.value, inline: field.inline ?? undefined };
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Embed = Embed;
|
|
||||||
//# sourceMappingURL=Embed.js.map
|
|
||||||
-1
File diff suppressed because one or more lines are too long
-198
@@ -1,198 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import type { Snowflake } from 'discord-api-types/globals';
|
|
||||||
import type { URL } from 'url';
|
|
||||||
/**
|
|
||||||
* Wraps the content inside a codeblock with no language.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function codeBlock<C extends string>(content: C): `\`\`\`\n${C}\`\`\``;
|
|
||||||
/**
|
|
||||||
* Wraps the content inside a codeblock with the specified language.
|
|
||||||
* @param language The language for the codeblock.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function codeBlock<L extends string, C extends string>(language: L, content: C): `\`\`\`${L}\n${C}\`\`\``;
|
|
||||||
/**
|
|
||||||
* Wraps the content inside \`backticks\`, which formats it as inline code.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function inlineCode<C extends string>(content: C): `\`${C}\``;
|
|
||||||
/**
|
|
||||||
* Formats the content into italic text.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function italic<C extends string>(content: C): `_${C}_`;
|
|
||||||
/**
|
|
||||||
* Formats the content into bold text.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function bold<C extends string>(content: C): `**${C}**`;
|
|
||||||
/**
|
|
||||||
* Formats the content into underscored text.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function underscore<C extends string>(content: C): `__${C}__`;
|
|
||||||
/**
|
|
||||||
* Formats the content into strike-through text.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function strikethrough<C extends string>(content: C): `~~${C}~~`;
|
|
||||||
/**
|
|
||||||
* Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function quote<C extends string>(content: C): `> ${C}`;
|
|
||||||
/**
|
|
||||||
* Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function blockQuote<C extends string>(content: C): `>>> ${C}`;
|
|
||||||
/**
|
|
||||||
* Wraps the URL into `<>`, which stops it from embedding.
|
|
||||||
* @param url The URL to wrap.
|
|
||||||
*/
|
|
||||||
export declare function hideLinkEmbed<C extends string>(url: C): `<${C}>`;
|
|
||||||
/**
|
|
||||||
* Wraps the URL into `<>`, which stops it from embedding.
|
|
||||||
* @param url The URL to wrap.
|
|
||||||
*/
|
|
||||||
export declare function hideLinkEmbed(url: URL): `<${string}>`;
|
|
||||||
/**
|
|
||||||
* Formats the content and the URL into a masked URL.
|
|
||||||
* @param content The content to display.
|
|
||||||
* @param url The URL the content links to.
|
|
||||||
*/
|
|
||||||
export declare function hyperlink<C extends string>(content: C, url: URL): `[${C}](${string})`;
|
|
||||||
/**
|
|
||||||
* Formats the content and the URL into a masked URL.
|
|
||||||
* @param content The content to display.
|
|
||||||
* @param url The URL the content links to.
|
|
||||||
*/
|
|
||||||
export declare function hyperlink<C extends string, U extends string>(content: C, url: U): `[${C}](${U})`;
|
|
||||||
/**
|
|
||||||
* Formats the content and the URL into a masked URL.
|
|
||||||
* @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.
|
|
||||||
*/
|
|
||||||
export declare function hyperlink<C extends string, T extends string>(content: C, url: URL, title: T): `[${C}](${string} "${T}")`;
|
|
||||||
/**
|
|
||||||
* Formats the content and the URL into a masked URL.
|
|
||||||
* @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.
|
|
||||||
*/
|
|
||||||
export declare function hyperlink<C extends string, U extends string, T extends string>(content: C, url: U, title: T): `[${C}](${U} "${T}")`;
|
|
||||||
/**
|
|
||||||
* Wraps the content inside spoiler (hidden text).
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
export declare function spoiler<C extends string>(content: C): `||${C}||`;
|
|
||||||
/**
|
|
||||||
* Formats a user ID into a user mention.
|
|
||||||
* @param userId The user ID to format.
|
|
||||||
*/
|
|
||||||
export declare function userMention<C extends Snowflake>(userId: C): `<@${C}>`;
|
|
||||||
/**
|
|
||||||
* Formats a user ID into a member-nickname mention.
|
|
||||||
* @param memberId The user ID to format.
|
|
||||||
*/
|
|
||||||
export declare function memberNicknameMention<C extends Snowflake>(memberId: C): `<@!${C}>`;
|
|
||||||
/**
|
|
||||||
* Formats a channel ID into a channel mention.
|
|
||||||
* @param channelId The channel ID to format.
|
|
||||||
*/
|
|
||||||
export declare function channelMention<C extends Snowflake>(channelId: C): `<#${C}>`;
|
|
||||||
/**
|
|
||||||
* Formats a role ID into a role mention.
|
|
||||||
* @param roleId The role ID to format.
|
|
||||||
*/
|
|
||||||
export declare function roleMention<C extends Snowflake>(roleId: C): `<@&${C}>`;
|
|
||||||
/**
|
|
||||||
* Formats an emoji ID into a fully qualified emoji identifier
|
|
||||||
* @param emojiId The emoji ID to format.
|
|
||||||
*/
|
|
||||||
export declare function formatEmoji<C extends Snowflake>(emojiId: C, animated?: false): `<:_:${C}>`;
|
|
||||||
/**
|
|
||||||
* Formats an emoji ID into a fully qualified emoji identifier
|
|
||||||
* @param emojiId The emoji ID to format.
|
|
||||||
* @param animated Whether the emoji is animated or not. Defaults to `false`
|
|
||||||
*/
|
|
||||||
export declare function formatEmoji<C extends Snowflake>(emojiId: C, animated?: true): `<a:_:${C}>`;
|
|
||||||
/**
|
|
||||||
* Formats a date into a short date-time string.
|
|
||||||
* @param date The date to format, defaults to the current time.
|
|
||||||
*/
|
|
||||||
export declare function time(date?: Date): `<t:${bigint}>`;
|
|
||||||
/**
|
|
||||||
* Formats a date given a format style.
|
|
||||||
* @param date The date to format.
|
|
||||||
* @param style The style to use.
|
|
||||||
*/
|
|
||||||
export declare function time<S extends TimestampStylesString>(date: Date, style: S): `<t:${bigint}:${S}>`;
|
|
||||||
/**
|
|
||||||
* Formats the given timestamp into a short date-time string.
|
|
||||||
* @param seconds The time to format, represents an UNIX timestamp in seconds.
|
|
||||||
*/
|
|
||||||
export declare function time<C extends number>(seconds: C): `<t:${C}>`;
|
|
||||||
/**
|
|
||||||
* Formats the given timestamp into a short date-time string.
|
|
||||||
* @param seconds The time to format, represents an UNIX timestamp in seconds.
|
|
||||||
* @param style The style to use.
|
|
||||||
*/
|
|
||||||
export declare function time<C extends number, S extends TimestampStylesString>(seconds: C, style: S): `<t:${C}:${S}>`;
|
|
||||||
/**
|
|
||||||
* The [message formatting timestamp styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.
|
|
||||||
*/
|
|
||||||
export declare const TimestampStyles: {
|
|
||||||
/**
|
|
||||||
* Short time format, consisting of hours and minutes, e.g. 16:20.
|
|
||||||
*/
|
|
||||||
readonly ShortTime: "t";
|
|
||||||
/**
|
|
||||||
* Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
|
|
||||||
*/
|
|
||||||
readonly LongTime: "T";
|
|
||||||
/**
|
|
||||||
* Short date format, consisting of day, month, and year, e.g. 20/04/2021.
|
|
||||||
*/
|
|
||||||
readonly ShortDate: "d";
|
|
||||||
/**
|
|
||||||
* Long date format, consisting of day, month, and year, e.g. 20 April 2021.
|
|
||||||
*/
|
|
||||||
readonly LongDate: "D";
|
|
||||||
/**
|
|
||||||
* Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
|
|
||||||
*/
|
|
||||||
readonly ShortDateTime: "f";
|
|
||||||
/**
|
|
||||||
* Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
|
|
||||||
*/
|
|
||||||
readonly LongDateTime: "F";
|
|
||||||
/**
|
|
||||||
* Relative time format, consisting of a relative duration format, e.g. 2 months ago.
|
|
||||||
*/
|
|
||||||
readonly RelativeTime: "R";
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* The possible values, see {@link TimestampStyles} for more information.
|
|
||||||
*/
|
|
||||||
export declare type TimestampStylesString = typeof TimestampStyles[keyof typeof TimestampStyles];
|
|
||||||
/**
|
|
||||||
* An enum with all the available faces from Discord's native slash commands
|
|
||||||
*/
|
|
||||||
export declare enum Faces {
|
|
||||||
/**
|
|
||||||
* ¯\\_(ツ)\\_/¯
|
|
||||||
*/
|
|
||||||
Shrug = "\u00AF\\_(\u30C4)\\_/\u00AF",
|
|
||||||
/**
|
|
||||||
* (╯°□°)╯︵ ┻━┻
|
|
||||||
*/
|
|
||||||
Tableflip = "(\u256F\u00B0\u25A1\u00B0\uFF09\u256F\uFE35 \u253B\u2501\u253B",
|
|
||||||
/**
|
|
||||||
* ┬─┬ ノ( ゜-゜ノ)
|
|
||||||
*/
|
|
||||||
Unflip = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)"
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=formatters.d.ts.map
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"formatters.d.ts","sourceRoot":"/","sources":["messages/formatters.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;AAKjH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAEnE;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAE7D;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAE7D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAEnE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAEtE;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAE5D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,CAEnE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;AAElE;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,MAAM,GAAG,CAAC;AAMvD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC,KAAK,MAAM,GAAG,CAAC;AAEvF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AAElG;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAC3D,OAAO,EAAE,CAAC,EACV,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,CAAC,GACN,IAAI,CAAC,KAAK,MAAM,KAAK,CAAC,IAAI,CAAC;AAE9B;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAC7E,OAAO,EAAE,CAAC,EACV,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,CAAC,GACN,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;AAMzB;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAEhE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,CAErE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAElF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,CAE3E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAEtE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC;AAE5F;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC;AAW5F;;;GAGG;AACH,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,MAAM,GAAG,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,qBAAqB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC;AAElG;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAS/G;;GAEG;AACH,eAAO,MAAM,eAAe;IAC3B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEM,CAAC;AAEX;;GAEG;AACH,oBAAY,qBAAqB,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEzF;;GAEG;AACH,oBAAY,KAAK;IAChB;;OAEG;IACH,KAAK,gCAAiB;IAEtB;;OAEG;IACH,SAAS,mEAAiB;IAE1B;;OAEG;IACH,MAAM,oDAAiB;CACvB"}
|
|
||||||
-181
@@ -1,181 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.Faces = exports.TimestampStyles = exports.time = exports.formatEmoji = exports.roleMention = exports.channelMention = exports.memberNicknameMention = exports.userMention = exports.spoiler = exports.hyperlink = exports.hideLinkEmbed = exports.blockQuote = exports.quote = exports.strikethrough = exports.underscore = exports.bold = exports.italic = exports.inlineCode = exports.codeBlock = void 0;
|
|
||||||
function codeBlock(language, content) {
|
|
||||||
return typeof content === 'undefined' ? `\`\`\`\n${language}\`\`\`` : `\`\`\`${language}\n${content}\`\`\``;
|
|
||||||
}
|
|
||||||
exports.codeBlock = codeBlock;
|
|
||||||
/**
|
|
||||||
* Wraps the content inside \`backticks\`, which formats it as inline code.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
function inlineCode(content) {
|
|
||||||
return `\`${content}\``;
|
|
||||||
}
|
|
||||||
exports.inlineCode = inlineCode;
|
|
||||||
/**
|
|
||||||
* Formats the content into italic text.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
function italic(content) {
|
|
||||||
return `_${content}_`;
|
|
||||||
}
|
|
||||||
exports.italic = italic;
|
|
||||||
/**
|
|
||||||
* Formats the content into bold text.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
function bold(content) {
|
|
||||||
return `**${content}**`;
|
|
||||||
}
|
|
||||||
exports.bold = bold;
|
|
||||||
/**
|
|
||||||
* Formats the content into underscored text.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
function underscore(content) {
|
|
||||||
return `__${content}__`;
|
|
||||||
}
|
|
||||||
exports.underscore = underscore;
|
|
||||||
/**
|
|
||||||
* Formats the content into strike-through text.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
function strikethrough(content) {
|
|
||||||
return `~~${content}~~`;
|
|
||||||
}
|
|
||||||
exports.strikethrough = strikethrough;
|
|
||||||
/**
|
|
||||||
* Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
function quote(content) {
|
|
||||||
return `> ${content}`;
|
|
||||||
}
|
|
||||||
exports.quote = quote;
|
|
||||||
/**
|
|
||||||
* Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
function blockQuote(content) {
|
|
||||||
return `>>> ${content}`;
|
|
||||||
}
|
|
||||||
exports.blockQuote = blockQuote;
|
|
||||||
function hideLinkEmbed(url) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
||||||
return `<${url}>`;
|
|
||||||
}
|
|
||||||
exports.hideLinkEmbed = hideLinkEmbed;
|
|
||||||
function hyperlink(content, url, title) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
||||||
return title ? `[${content}](${url} "${title}")` : `[${content}](${url})`;
|
|
||||||
}
|
|
||||||
exports.hyperlink = hyperlink;
|
|
||||||
/**
|
|
||||||
* Wraps the content inside spoiler (hidden text).
|
|
||||||
* @param content The content to wrap.
|
|
||||||
*/
|
|
||||||
function spoiler(content) {
|
|
||||||
return `||${content}||`;
|
|
||||||
}
|
|
||||||
exports.spoiler = spoiler;
|
|
||||||
/**
|
|
||||||
* Formats a user ID into a user mention.
|
|
||||||
* @param userId The user ID to format.
|
|
||||||
*/
|
|
||||||
function userMention(userId) {
|
|
||||||
return `<@${userId}>`;
|
|
||||||
}
|
|
||||||
exports.userMention = userMention;
|
|
||||||
/**
|
|
||||||
* Formats a user ID into a member-nickname mention.
|
|
||||||
* @param memberId The user ID to format.
|
|
||||||
*/
|
|
||||||
function memberNicknameMention(memberId) {
|
|
||||||
return `<@!${memberId}>`;
|
|
||||||
}
|
|
||||||
exports.memberNicknameMention = memberNicknameMention;
|
|
||||||
/**
|
|
||||||
* Formats a channel ID into a channel mention.
|
|
||||||
* @param channelId The channel ID to format.
|
|
||||||
*/
|
|
||||||
function channelMention(channelId) {
|
|
||||||
return `<#${channelId}>`;
|
|
||||||
}
|
|
||||||
exports.channelMention = channelMention;
|
|
||||||
/**
|
|
||||||
* Formats a role ID into a role mention.
|
|
||||||
* @param roleId The role ID to format.
|
|
||||||
*/
|
|
||||||
function roleMention(roleId) {
|
|
||||||
return `<@&${roleId}>`;
|
|
||||||
}
|
|
||||||
exports.roleMention = roleMention;
|
|
||||||
/**
|
|
||||||
* Formats an emoji ID into a fully qualified emoji identifier
|
|
||||||
* @param emojiId The emoji ID to format.
|
|
||||||
* @param animated Whether the emoji is animated or not. Defaults to `false`
|
|
||||||
*/
|
|
||||||
function formatEmoji(emojiId, animated = false) {
|
|
||||||
return `<${animated ? 'a' : ''}:_:${emojiId}>`;
|
|
||||||
}
|
|
||||||
exports.formatEmoji = formatEmoji;
|
|
||||||
function time(timeOrSeconds, style) {
|
|
||||||
if (typeof timeOrSeconds !== 'number') {
|
|
||||||
timeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1000);
|
|
||||||
}
|
|
||||||
return typeof style === 'string' ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;
|
|
||||||
}
|
|
||||||
exports.time = time;
|
|
||||||
/**
|
|
||||||
* The [message formatting timestamp styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.
|
|
||||||
*/
|
|
||||||
exports.TimestampStyles = {
|
|
||||||
/**
|
|
||||||
* Short time format, consisting of hours and minutes, e.g. 16:20.
|
|
||||||
*/
|
|
||||||
ShortTime: 't',
|
|
||||||
/**
|
|
||||||
* Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
|
|
||||||
*/
|
|
||||||
LongTime: 'T',
|
|
||||||
/**
|
|
||||||
* Short date format, consisting of day, month, and year, e.g. 20/04/2021.
|
|
||||||
*/
|
|
||||||
ShortDate: 'd',
|
|
||||||
/**
|
|
||||||
* Long date format, consisting of day, month, and year, e.g. 20 April 2021.
|
|
||||||
*/
|
|
||||||
LongDate: 'D',
|
|
||||||
/**
|
|
||||||
* Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
|
|
||||||
*/
|
|
||||||
ShortDateTime: 'f',
|
|
||||||
/**
|
|
||||||
* Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
|
|
||||||
*/
|
|
||||||
LongDateTime: 'F',
|
|
||||||
/**
|
|
||||||
* Relative time format, consisting of a relative duration format, e.g. 2 months ago.
|
|
||||||
*/
|
|
||||||
RelativeTime: 'R',
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* An enum with all the available faces from Discord's native slash commands
|
|
||||||
*/
|
|
||||||
var Faces;
|
|
||||||
(function (Faces) {
|
|
||||||
/**
|
|
||||||
* ¯\\_(ツ)\\_/¯
|
|
||||||
*/
|
|
||||||
Faces["Shrug"] = "\u00AF\\_(\u30C4)\\_/\u00AF";
|
|
||||||
/**
|
|
||||||
* (╯°□°)╯︵ ┻━┻
|
|
||||||
*/
|
|
||||||
Faces["Tableflip"] = "(\u256F\u00B0\u25A1\u00B0\uFF09\u256F\uFE35 \u253B\u2501\u253B";
|
|
||||||
/**
|
|
||||||
* ┬─┬ ノ( ゜-゜ノ)
|
|
||||||
*/
|
|
||||||
Faces["Unflip"] = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)";
|
|
||||||
})(Faces = exports.Faces || (exports.Faces = {}));
|
|
||||||
//# sourceMappingURL=formatters.js.map
|
|
||||||
-1
File diff suppressed because one or more lines are too long
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2020 vladfrangu
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
-97
@@ -1,97 +0,0 @@
|
|||||||
# Discord API Types
|
|
||||||
|
|
||||||
[](https://github.com/discordjs/discord-api-types/blob/main/LICENSE.md)
|
|
||||||
[](https://www.npmjs.com/package/discord-api-types)
|
|
||||||
[](https://deno.land/x/discord_api_types)
|
|
||||||
[](https://www.patreon.com/vladfrangu)
|
|
||||||
[](https://ko-fi.com/wolfgalvlad)
|
|
||||||
[](https://github.com/sponsors/vladfrangu)
|
|
||||||
|
|
||||||
Simple type definitions for the [Discord API](https://discord.com/developers/docs/intro).
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Install with [npm](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install discord-api-types
|
|
||||||
yarn add discord-api-types
|
|
||||||
pnpm add discord-api-types
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where the `*` represents the API version. Below are some examples
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { APIUser } = require('discord-api-types/v9');
|
|
||||||
```
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// TypeScript/ES Module support
|
|
||||||
import { APIUser } from 'discord-api-types/v9';
|
|
||||||
```
|
|
||||||
|
|
||||||
You may also import just certain parts of the module that you need. The possible values are: `globals`, `gateway`, `gateway/v*`, `payloads`, `payloads/v*`, `rest`, `rest/v*`, `rpc`, `rpc/v*`, `utils`, `utils/v*`, `voice`, and `voice/v*`. Below are some examples
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { GatewayVersion } = require('discord-api-types/gateway/v9');
|
|
||||||
```
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// TypeScript/ES Module support
|
|
||||||
import { GatewayVersion } from 'discord-api-types/gateway/v9';
|
|
||||||
```
|
|
||||||
|
|
||||||
> _**Note:** The `v*` exports (`discord-api-type/v*`) include the appropriate version of `gateway`, `payloads`, `rest`, `rpc`, and `utils` you specified, alongside the `globals` exports_
|
|
||||||
|
|
||||||
### Deno
|
|
||||||
|
|
||||||
We also provide typings compatible with the [deno](https://deno.land/) runtime. You have 3 ways you can import them:
|
|
||||||
|
|
||||||
1. Directly from GitHub
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Importing a specific API version
|
|
||||||
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v9.ts';
|
|
||||||
```
|
|
||||||
|
|
||||||
2. From [deno.land/x](https://deno.land/x)
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Importing a specific API version
|
|
||||||
import { APIUser } from 'https://deno.land/x/discord_api_types/v9.ts';
|
|
||||||
```
|
|
||||||
|
|
||||||
3. From [skypack.dev](https://www.skypack.dev/)
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Importing a specific API version
|
|
||||||
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v9?dts';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Project Structure
|
|
||||||
|
|
||||||
The exports of each API version is split into three main parts:
|
|
||||||
|
|
||||||
- Everything exported with the `API` prefix represents a payload you may get from the REST API _or_ the Gateway.
|
|
||||||
|
|
||||||
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly related to the Gateway.
|
|
||||||
|
|
||||||
- Everything exported with the `REST` prefix represents data that ONLY comes from or is directly related to the REST API.
|
|
||||||
|
|
||||||
- For endpoint options, they will follow the following structure: `REST<HTTP Method><Type><Query|(JSON|FormData)Body|Result>` where the type represents what it will return.
|
|
||||||
|
|
||||||
- For example, `RESTPostAPIChannelMessageJSONBody` or `RESTGetAPIGatewayBotInfoResult`.
|
|
||||||
|
|
||||||
- Some exported types (specifically OAuth2 related ones) may not respect this entire structure due to the nature of the fields. They will start with either `RESTOAuth2` or with something similar to `REST<HTTP Method>OAuth2`
|
|
||||||
|
|
||||||
- If a type ends with `Result`, then it represents the expected result by calling its accompanying route.
|
|
||||||
|
|
||||||
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore it. This does **not** account for errors.
|
|
||||||
|
|
||||||
- Anything else that is miscellaneous will be exported based on what it represents (for example the `REST` route object).
|
|
||||||
|
|
||||||
- There may be types exported that are identical for all versions. These will be exported as is and can be found in the `globals` file. They will still be prefixed accordingly as described above.
|
|
||||||
|
|
||||||
**Warning**: This package documents just KNOWN (and documented) properties. Anything that isn't documented will NOT be added to this package (unless said properties are in an open Pull Request to Discord's [API Documentation repository](https://github.com/discord/discord-api-docs) or known through other means _and have received the green light to be used_). For clarification's sake, this means that properties that are only known through the process of data mining and have not yet been confirmed in a way as described will **NOT** be included.
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params
|
|
||||||
*/
|
|
||||||
export interface GatewayURLQuery {
|
|
||||||
v: string;
|
|
||||||
encoding: 'json' | 'etf';
|
|
||||||
compress?: 'zlib-stream';
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=common.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,QAAQ,CAAC,EAAE,aAAa,CAAC;CACzB"}
|
|
||||||
Generated
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
//# sourceMappingURL=common.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"common.js","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":""}
|
|
||||||
Generated
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
export * from './v9';
|
|
||||||
//# sourceMappingURL=index.d.ts.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAGA,cAAc,MAAM,CAAC"}
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
// This file exports all the types available in the recommended gateway version
|
|
||||||
// Thereby, things MAY break in the future. Try sticking to imports from a specific version
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
||||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
__exportStar(require("./v9"), exports);
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,2FAA2F;;;;;;;;;;;;AAE3F,uCAAqB"}
|
|
||||||
Generated
Vendored
-8
@@ -1,8 +0,0 @@
|
|||||||
import mod from "./index.js";
|
|
||||||
|
|
||||||
export default mod;
|
|
||||||
export const GatewayCloseCodes = mod.GatewayCloseCodes;
|
|
||||||
export const GatewayDispatchEvents = mod.GatewayDispatchEvents;
|
|
||||||
export const GatewayIntentBits = mod.GatewayIntentBits;
|
|
||||||
export const GatewayOpcodes = mod.GatewayOpcodes;
|
|
||||||
export const GatewayVersion = mod.GatewayVersion;
|
|
||||||
-608
@@ -1,608 +0,0 @@
|
|||||||
/**
|
|
||||||
* Types extracted from https://discord.com/developers/docs/topics/gateway
|
|
||||||
*/
|
|
||||||
import type { APIChannel, APIEmoji, APIGuild, APIGuildMember, APIMessage, APIRole, APIUnavailableGuild, APIUser, GatewayActivity, GatewayPresenceUpdate as RawGatewayPresenceUpdate, GatewayVoiceState, InviteTargetUserType, PresenceUpdateStatus } from '../payloads/v6/index';
|
|
||||||
export * from './common';
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare const GatewayVersion = "6";
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare enum GatewayOPCodes {
|
|
||||||
Dispatch = 0,
|
|
||||||
Heartbeat = 1,
|
|
||||||
Identify = 2,
|
|
||||||
PresenceUpdate = 3,
|
|
||||||
VoiceStateUpdate = 4,
|
|
||||||
Resume = 6,
|
|
||||||
Reconnect = 7,
|
|
||||||
RequestGuildMembers = 8,
|
|
||||||
InvalidSession = 9,
|
|
||||||
Hello = 10,
|
|
||||||
HeartbeatAck = 11
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare enum GatewayCloseCodes {
|
|
||||||
UnknownError = 4000,
|
|
||||||
UnknownOpCode = 4001,
|
|
||||||
DecodeError = 4002,
|
|
||||||
NotAuthenticated = 4003,
|
|
||||||
AuthenticationFailed = 4004,
|
|
||||||
AlreadyAuthenticated = 4005,
|
|
||||||
InvalidSeq = 4007,
|
|
||||||
RateLimited = 4008,
|
|
||||||
SessionTimedOut = 4009,
|
|
||||||
InvalidShard = 4010,
|
|
||||||
ShardingRequired = 4011,
|
|
||||||
InvalidAPIVersion = 4012,
|
|
||||||
InvalidIntents = 4013,
|
|
||||||
DisallowedIntents = 4014
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare enum VoiceOPCodes {
|
|
||||||
Identify = 0,
|
|
||||||
SelectProtocol = 1,
|
|
||||||
Ready = 2,
|
|
||||||
Heartbeat = 3,
|
|
||||||
SessionDescription = 4,
|
|
||||||
Speaking = 5,
|
|
||||||
HeartbeatAck = 6,
|
|
||||||
Resume = 7,
|
|
||||||
Hello = 8,
|
|
||||||
Resumed = 9,
|
|
||||||
ClientDisconnect = 13
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare enum VoiceCloseCodes {
|
|
||||||
UnknownOpCode = 4001,
|
|
||||||
NotAuthenticated = 4003,
|
|
||||||
AuthenticationFailed = 4004,
|
|
||||||
AlreadyAuthenticated = 4005,
|
|
||||||
SessionNoLongerValid = 4006,
|
|
||||||
SessionTimeout = 4009,
|
|
||||||
ServerNotFound = 4011,
|
|
||||||
UnknownProtocol = 4012,
|
|
||||||
Disconnected = 4014,
|
|
||||||
VoiceServerCrashed = 4015,
|
|
||||||
UnknownEncryptionMode = 4016
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#list-of-intents
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare enum GatewayIntentBits {
|
|
||||||
GUILDS = 1,
|
|
||||||
GUILD_MEMBERS = 2,
|
|
||||||
GUILD_BANS = 4,
|
|
||||||
GUILD_EMOJIS = 8,
|
|
||||||
GUILD_INTEGRATIONS = 16,
|
|
||||||
GUILD_WEBHOOKS = 32,
|
|
||||||
GUILD_INVITES = 64,
|
|
||||||
GUILD_VOICE_STATES = 128,
|
|
||||||
GUILD_PRESENCES = 256,
|
|
||||||
GUILD_MESSAGES = 512,
|
|
||||||
GUILD_MESSAGE_REACTIONS = 1024,
|
|
||||||
GUILD_MESSAGE_TYPING = 2048,
|
|
||||||
DIRECT_MESSAGES = 4096,
|
|
||||||
DIRECT_MESSAGE_REACTIONS = 8192,
|
|
||||||
DIRECT_MESSAGE_TYPING = 16384
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare enum GatewayDispatchEvents {
|
|
||||||
Ready = "READY",
|
|
||||||
Resumed = "RESUMED",
|
|
||||||
ChannelCreate = "CHANNEL_CREATE",
|
|
||||||
ChannelUpdate = "CHANNEL_UPDATE",
|
|
||||||
ChannelDelete = "CHANNEL_DELETE",
|
|
||||||
ChannelPinsUpdate = "CHANNEL_PINS_UPDATE",
|
|
||||||
GuildCreate = "GUILD_CREATE",
|
|
||||||
GuildUpdate = "GUILD_UPDATE",
|
|
||||||
GuildDelete = "GUILD_DELETE",
|
|
||||||
GuildBanAdd = "GUILD_BAN_ADD",
|
|
||||||
GuildBanRemove = "GUILD_BAN_REMOVE",
|
|
||||||
GuildEmojisUpdate = "GUILD_EMOJIS_UPDATE",
|
|
||||||
GuildIntegrationsUpdate = "GUILD_INTEGRATIONS_UPDATE",
|
|
||||||
GuildMemberAdd = "GUILD_MEMBER_ADD",
|
|
||||||
GuildMemberRemove = "GUILD_MEMBER_REMOVE",
|
|
||||||
GuildMemberUpdate = "GUILD_MEMBER_UPDATE",
|
|
||||||
GuildMembersChunk = "GUILD_MEMBERS_CHUNK",
|
|
||||||
GuildRoleCreate = "GUILD_ROLE_CREATE",
|
|
||||||
GuildRoleUpdate = "GUILD_ROLE_UPDATE",
|
|
||||||
GuildRoleDelete = "GUILD_ROLE_DELETE",
|
|
||||||
InviteCreate = "INVITE_CREATE",
|
|
||||||
InviteDelete = "INVITE_DELETE",
|
|
||||||
MessageCreate = "MESSAGE_CREATE",
|
|
||||||
MessageUpdate = "MESSAGE_UPDATE",
|
|
||||||
MessageDelete = "MESSAGE_DELETE",
|
|
||||||
MessageDeleteBulk = "MESSAGE_DELETE_BULK",
|
|
||||||
MessageReactionAdd = "MESSAGE_REACTION_ADD",
|
|
||||||
MessageReactionRemove = "MESSAGE_REACTION_REMOVE",
|
|
||||||
MessageReactionRemoveAll = "MESSAGE_REACTION_REMOVE_ALL",
|
|
||||||
MessageReactionRemoveEmoji = "MESSAGE_REACTION_REMOVE_EMOJI",
|
|
||||||
PresenceUpdate = "PRESENCE_UPDATE",
|
|
||||||
TypingStart = "TYPING_START",
|
|
||||||
UserUpdate = "USER_UPDATE",
|
|
||||||
VoiceStateUpdate = "VOICE_STATE_UPDATE",
|
|
||||||
VoiceServerUpdate = "VOICE_SERVER_UPDATE",
|
|
||||||
WebhooksUpdate = "WEBHOOKS_UPDATE"
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewaySendPayload = GatewayHeartbeat | GatewayIdentify | GatewayUpdatePresence | GatewayVoiceStateUpdate | GatewayResume | GatewayRequestGuildMembers;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayReceivePayload = GatewayHello | GatewayHeartbeatRequest | GatewayHeartbeatAck | GatewayInvalidSession | GatewayReconnect | GatewayDispatchPayload;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayDispatchPayload = GatewayReadyDispatch | GatewayResumedDispatch | GatewayChannelModifyDispatch | GatewayChannelPinsUpdateDispatch | GatewayGuildModifyDispatch | GatewayGuildDeleteDispatch | GatewayGuildBanModifyDispatch | GatewayGuildEmojisUpdateDispatch | GatewayGuildIntegrationsUpdateDispatch | GatewayGuildMemberAddDispatch | GatewayGuildMemberRemoveDispatch | GatewayGuildMemberUpdateDispatch | GatewayGuildMembersChunkDispatch | GatewayGuildRoleModifyDispatch | GatewayGuildRoleDeleteDispatch | GatewayInviteCreateDispatch | GatewayInviteDeleteDispatch | GatewayMessageCreateDispatch | GatewayMessageUpdateDispatch | GatewayMessageDeleteDispatch | GatewayMessageDeleteBulkDispatch | GatewayMessageReactionAddDispatch | GatewayMessageReactionRemoveDispatch | GatewayMessageReactionRemoveAllDispatch | GatewayMessageReactionRemoveEmojiDispatch | GatewayPresenceUpdateDispatch | GatewayTypingStartDispatch | GatewayUserUpdateDispatch | GatewayVoiceStateUpdateDispatch | GatewayVoiceServerUpdateDispatch | GatewayWebhooksUpdateDispatch;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#hello
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayHello extends NonDispatchPayload {
|
|
||||||
op: GatewayOPCodes.Hello;
|
|
||||||
d: {
|
|
||||||
heartbeat_interval: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#heartbeating
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayHeartbeatRequest extends NonDispatchPayload {
|
|
||||||
op: GatewayOPCodes.Heartbeat;
|
|
||||||
d: never;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#heartbeating-example-gateway-heartbeat-ack
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayHeartbeatAck extends NonDispatchPayload {
|
|
||||||
op: GatewayOPCodes.HeartbeatAck;
|
|
||||||
d: never;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#invalid-session
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayInvalidSession extends NonDispatchPayload {
|
|
||||||
op: GatewayOPCodes.InvalidSession;
|
|
||||||
d: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#reconnect
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayReconnect extends NonDispatchPayload {
|
|
||||||
op: GatewayOPCodes.Reconnect;
|
|
||||||
d: never;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#ready
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayReadyDispatch = DataPayload<GatewayDispatchEvents.Ready, {
|
|
||||||
v: number;
|
|
||||||
user: APIUser;
|
|
||||||
session_id: string;
|
|
||||||
private_channels: [];
|
|
||||||
guilds: APIUnavailableGuild[];
|
|
||||||
shard?: [number, number];
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#resumed
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayResumedDispatch = DataPayload<GatewayDispatchEvents.Resumed, never>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#channel-create
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#channel-update
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#channel-delete
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayChannelModifyDispatch = DataPayload<GatewayDispatchEvents.ChannelCreate | GatewayDispatchEvents.ChannelDelete | GatewayDispatchEvents.ChannelUpdate, APIChannel>;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayChannelCreateDispatch = GatewayChannelModifyDispatch;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayChannelUpdateDispatch = GatewayChannelModifyDispatch;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayChannelDeleteDispatch = GatewayChannelModifyDispatch;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#channel-pins-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayChannelPinsUpdateDispatch = DataPayload<GatewayDispatchEvents.ChannelPinsUpdate, {
|
|
||||||
guild_id?: string;
|
|
||||||
channel_id: string;
|
|
||||||
last_pin_timestamp?: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-create
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildModifyDispatch = DataPayload<GatewayDispatchEvents.GuildCreate | GatewayDispatchEvents.GuildUpdate, APIGuild>;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildCreateDispatch = GatewayGuildModifyDispatch;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildUpdateDispatch = GatewayGuildModifyDispatch;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-delete
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildDeleteDispatch = DataPayload<GatewayDispatchEvents.GuildDelete, APIUnavailableGuild>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-ban-add
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-ban-remove
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildBanModifyDispatch = DataPayload<GatewayDispatchEvents.GuildBanAdd | GatewayDispatchEvents.GuildBanRemove, {
|
|
||||||
guild_id: string;
|
|
||||||
user: APIUser;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildBanAddDispatch = GatewayGuildBanModifyDispatch;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildBanRemoveDispatch = GatewayGuildBanModifyDispatch;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-emojis-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildEmojisUpdateDispatch = DataPayload<GatewayDispatchEvents.GuildEmojisUpdate, {
|
|
||||||
guild_id: string;
|
|
||||||
emojis: APIEmoji[];
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-integrations-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildIntegrationsUpdateDispatch = DataPayload<GatewayDispatchEvents.GuildIntegrationsUpdate, {
|
|
||||||
guild_id: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-member-add
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildMemberAddDispatch = DataPayload<GatewayDispatchEvents.GuildMemberAdd, APIGuildMember & {
|
|
||||||
guild_id: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-member-remove
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildMemberRemoveDispatch = DataPayload<GatewayDispatchEvents.GuildMemberRemove, {
|
|
||||||
guild_id: string;
|
|
||||||
user: APIUser;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildMemberUpdateDispatch = DataPayload<GatewayDispatchEvents.GuildMemberUpdate, Omit<APIGuildMember, 'deaf' | 'mute'> & {
|
|
||||||
guild_id: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-members-chunk
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildMembersChunkDispatch = DataPayload<GatewayDispatchEvents.GuildMembersChunk, {
|
|
||||||
guild_id: string;
|
|
||||||
members: APIGuildMember[];
|
|
||||||
chunk_index?: number;
|
|
||||||
chunk_count?: number;
|
|
||||||
not_found?: unknown[];
|
|
||||||
presences?: RawGatewayPresenceUpdate[];
|
|
||||||
nonce?: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-role-create
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-role-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildRoleModifyDispatch = DataPayload<GatewayDispatchEvents.GuildRoleCreate | GatewayDispatchEvents.GuildRoleUpdate, {
|
|
||||||
guild_id: string;
|
|
||||||
role: APIRole;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildRoleCreateDispatch = GatewayGuildRoleModifyDispatch;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildRoleUpdateDispatch = GatewayGuildRoleModifyDispatch;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#guild-role-delete
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayGuildRoleDeleteDispatch = DataPayload<GatewayDispatchEvents.GuildRoleDelete, {
|
|
||||||
guild_id: string;
|
|
||||||
role_id: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#invite-create
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayInviteCreateDispatch = DataPayload<GatewayDispatchEvents.InviteCreate, {
|
|
||||||
channel_id: string;
|
|
||||||
code: string;
|
|
||||||
created_at: number;
|
|
||||||
guild_id?: string;
|
|
||||||
inviter?: APIUser;
|
|
||||||
max_age: number;
|
|
||||||
max_uses: number;
|
|
||||||
target_user?: APIUser;
|
|
||||||
target_user_type?: InviteTargetUserType;
|
|
||||||
temporary: boolean;
|
|
||||||
uses: 0;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#invite-delete
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayInviteDeleteDispatch = DataPayload<GatewayDispatchEvents.InviteDelete, {
|
|
||||||
channel_id: string;
|
|
||||||
guild_id?: string;
|
|
||||||
code: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#message-create
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayMessageCreateDispatch = DataPayload<GatewayDispatchEvents.MessageCreate, APIMessage>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#message-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayMessageUpdateDispatch = DataPayload<GatewayDispatchEvents.MessageUpdate, {
|
|
||||||
id: string;
|
|
||||||
channel_id: string;
|
|
||||||
} & Partial<APIMessage>>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#message-delete
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayMessageDeleteDispatch = DataPayload<GatewayDispatchEvents.MessageDelete, {
|
|
||||||
id: string;
|
|
||||||
channel_id: string;
|
|
||||||
guild_id?: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#message-delete-bulk
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayMessageDeleteBulkDispatch = DataPayload<GatewayDispatchEvents.MessageDeleteBulk, {
|
|
||||||
ids: string[];
|
|
||||||
channel_id: string;
|
|
||||||
guild_id?: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#message-reaction-add
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayMessageReactionAddDispatch = ReactionData<GatewayDispatchEvents.MessageReactionAdd>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayMessageReactionRemoveDispatch = ReactionData<GatewayDispatchEvents.MessageReactionRemove, 'member'>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayMessageReactionRemoveAllDispatch = DataPayload<GatewayDispatchEvents.MessageReactionRemoveAll, MessageReactionRemoveData>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayMessageReactionRemoveEmojiDispatch = DataPayload<GatewayDispatchEvents.MessageReactionRemoveEmoji, MessageReactionRemoveData & {
|
|
||||||
emoji: APIEmoji;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#presence-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayPresenceUpdateDispatch = DataPayload<GatewayDispatchEvents.PresenceUpdate, RawGatewayPresenceUpdate>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#typing-start
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayTypingStartDispatch = DataPayload<GatewayDispatchEvents.TypingStart, {
|
|
||||||
channel_id: string;
|
|
||||||
guild_id?: string;
|
|
||||||
user_id: string;
|
|
||||||
timestamp: number;
|
|
||||||
member?: APIGuildMember;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#user-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayUserUpdateDispatch = DataPayload<GatewayDispatchEvents.UserUpdate, APIUser>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#voice-state-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayVoiceStateUpdateDispatch = DataPayload<GatewayDispatchEvents.VoiceStateUpdate, GatewayVoiceState>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#voice-server-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayVoiceServerUpdateDispatch = DataPayload<GatewayDispatchEvents.VoiceServerUpdate, {
|
|
||||||
token: string;
|
|
||||||
guild_id: string;
|
|
||||||
endpoint: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#webhooks-update
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export declare type GatewayWebhooksUpdateDispatch = DataPayload<GatewayDispatchEvents.WebhooksUpdate, {
|
|
||||||
guild_id: string;
|
|
||||||
channel_id: string;
|
|
||||||
}>;
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#heartbeating
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayHeartbeat {
|
|
||||||
op: GatewayOPCodes.Heartbeat;
|
|
||||||
d: number;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayIdentifyProperties {
|
|
||||||
$os: string;
|
|
||||||
$browser: string;
|
|
||||||
$device: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#identify
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayIdentify {
|
|
||||||
op: GatewayOPCodes.Identify;
|
|
||||||
d: {
|
|
||||||
token: string;
|
|
||||||
properties: GatewayIdentifyProperties;
|
|
||||||
compress?: boolean;
|
|
||||||
large_threshold?: number;
|
|
||||||
shard?: [shard_id: number, shard_count: number];
|
|
||||||
presence?: RawGatewayPresenceUpdate;
|
|
||||||
guild_subscriptions?: boolean;
|
|
||||||
intents?: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#resume
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayResume {
|
|
||||||
op: GatewayOPCodes.Resume;
|
|
||||||
d: {
|
|
||||||
token: string;
|
|
||||||
session_id: string;
|
|
||||||
seq: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#request-guild-members
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayRequestGuildMembers {
|
|
||||||
op: GatewayOPCodes.RequestGuildMembers;
|
|
||||||
d: {
|
|
||||||
guild_id: string | string[];
|
|
||||||
query?: string;
|
|
||||||
limit: number;
|
|
||||||
presences?: boolean;
|
|
||||||
user_ids?: string | string[];
|
|
||||||
nonce?: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#update-voice-state
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayVoiceStateUpdate {
|
|
||||||
op: GatewayOPCodes.VoiceStateUpdate;
|
|
||||||
d: {
|
|
||||||
guild_id: string;
|
|
||||||
channel_id: string | null;
|
|
||||||
self_mute: boolean;
|
|
||||||
self_deaf: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#update-status
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayUpdatePresence {
|
|
||||||
op: GatewayOPCodes.PresenceUpdate;
|
|
||||||
d: GatewayPresenceUpdateData;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
export interface GatewayPresenceUpdateData {
|
|
||||||
since: number | null;
|
|
||||||
game: GatewayActivity | null;
|
|
||||||
status: PresenceUpdateStatus;
|
|
||||||
afk: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
interface BasePayload {
|
|
||||||
op: GatewayOPCodes;
|
|
||||||
s: number;
|
|
||||||
d?: unknown;
|
|
||||||
t?: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
declare type NonDispatchPayload = Omit<BasePayload, 't'>;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
|
|
||||||
op: GatewayOPCodes.Dispatch;
|
|
||||||
t: Event;
|
|
||||||
d: D;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
declare type ReactionData<E extends GatewayDispatchEvents, O extends string = never> = DataPayload<E, Omit<{
|
|
||||||
user_id: string;
|
|
||||||
channel_id: string;
|
|
||||||
message_id: string;
|
|
||||||
guild_id?: string;
|
|
||||||
member?: APIGuildMember;
|
|
||||||
emoji: APIEmoji;
|
|
||||||
}, O>>;
|
|
||||||
/**
|
|
||||||
* @deprecated Gateway v6 is deprecated and the types will not receive further updates, please update to v8.
|
|
||||||
*/
|
|
||||||
interface MessageReactionRemoveData {
|
|
||||||
channel_id: string;
|
|
||||||
message_id: string;
|
|
||||||
guild_id?: string;
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=v6.d.ts.map
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user