added all files
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,19 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,36 @@
|
||||
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
@@ -0,0 +1,12 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,63 @@
|
||||
"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
@@ -0,0 +1,63 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,113 @@
|
||||
"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
@@ -0,0 +1,64 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,123 @@
|
||||
"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
@@ -0,0 +1,20 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,48 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,25 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,71 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,54 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,91 @@
|
||||
"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
@@ -0,0 +1,15 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,42 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,18 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,18 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,18 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,18 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,18 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,18 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,18 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,7 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,18 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,23 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,26 @@
|
||||
"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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,140 @@
|
||||
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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,300 @@
|
||||
"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
@@ -0,0 +1,198 @@
|
||||
/// <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
@@ -0,0 +1 @@
|
||||
{"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
@@ -0,0 +1,181 @@
|
||||
"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
Reference in New Issue
Block a user