Skip to main content

Class: CommandStore

Stores all Command pieces

since 1.0.0

Hierarchy

Constructors

constructor

new CommandStore()

Overrides

AliasStore.constructor

Defined in

projects/framework/src/lib/structures/CommandStore.ts:11

Properties

Constructor

Readonly Constructor: Constructor<Command<Args, CommandOptions>>

Inherited from

AliasStore.Constructor

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:281


[toStringTag]

Readonly [toStringTag]: string

Inherited from

AliasStore.[toStringTag]

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:135


aliases

Readonly aliases: Collection<string, Command<Args, CommandOptions>>

The aliases referencing to pieces.

Inherited from

AliasStore.aliases

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:712


constructor

constructor: CollectionConstructor

Inherited from

AliasStore.constructor

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:17


name

Readonly name: string

Inherited from

AliasStore.name

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:282


paths

Readonly paths: Set<string>

Inherited from

AliasStore.paths

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:283


size

Readonly size: number

Inherited from

AliasStore.size

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:28


strategy

Readonly strategy: ILoaderStrategy<Command<Args, CommandOptions>>

Inherited from

AliasStore.strategy

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:284


[species]

Static Readonly [species]: MapConstructor

Inherited from

AliasStore.[species]

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:317


default

Static Readonly default: typeof Collection

Inherited from

AliasStore.default

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:24


defaultStrategy

Static defaultStrategy: ILoaderStrategy<any>

The default strategy, defaults to {@link LoaderStrategy}, which is constructed on demand when a store is constructed, when none was set beforehand.

Inherited from

AliasStore.defaultStrategy

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:369


logger

Static logger: null | StoreLogger

The default logger, defaults to null.

Inherited from

AliasStore.logger

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:373

Accessors

categories

get categories(): string[]

Get all the command categories.

Returns

string[]

Defined in

projects/framework/src/lib/structures/CommandStore.ts:18


container

get container(): Container

A reference to the {@link Container} object for ease of use.

see container

Returns

Container

Inherited from

AliasStore.container

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:294

Methods

[iterator]

[iterator](): IterableIterator<[string, Command<Args, CommandOptions>]>

Returns an iterable of entries in the map.

Returns

IterableIterator<[string, Command<Args, CommandOptions>]>

Inherited from

AliasStore.[iterator]

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:121


at

at(index?): undefined | Command<Args, CommandOptions>

Identical to Array.at(). Returns the item at a given index, allowing for positive and negative integers. Negative integers count back from the last item in the collection.

Parameters

NameTypeDescription
index?numberThe index of the element to obtain

Returns

undefined | Command<Args, CommandOptions>

Inherited from

AliasStore.at

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:87


clear

clear(): void

Returns

void

Inherited from

AliasStore.clear

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:22


clone

clone(): Collection<string, Command<Args, CommandOptions>>

Creates an identical shallow copy of this collection.

example const newColl = someColl.clone();

Returns

Collection<string, Command<Args, CommandOptions>>

Inherited from

AliasStore.clone

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:301


concat

concat(...collections): Collection<string, Command<Args, CommandOptions>>

Combines this collection with others into a new collection. None of the source collections are modified.

example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);

Parameters

NameTypeDescription
...collectionsCollection<string, Command<Args, CommandOptions>>[]Collections to merge

Returns

Collection<string, Command<Args, CommandOptions>>

Inherited from

AliasStore.concat

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:310


construct

construct(Ctor, data): Command<Args, CommandOptions>

Constructs a Piece instance.

Parameters

NameTypeDescription
CtorILoaderResultEntry<Command<Args, CommandOptions>>The Piece's constructor used to build the instance.
dataHydratedModuleDataThe module's information

Returns

Command<Args, CommandOptions>

An instance of the constructed piece.

Inherited from

AliasStore.construct

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:345


delete

delete(key): boolean

Parameters

NameType
keystring

Returns

boolean

Inherited from

AliasStore.delete

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:23


difference

difference(other): Collection<string, Command<Args, CommandOptions>>

The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.

Parameters

NameTypeDescription
otherCollection<string, Command<Args, CommandOptions>>The other Collection to filter against

Returns

Collection<string, Command<Args, CommandOptions>>

Inherited from

AliasStore.difference

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:344


each

each(fn): CommandStore

Identical to Map.forEach(), but returns the collection instead of undefined.

example collection .each(user => console.log(user.username)) .filter(user => user.bot) .each(user => console.log(user.username));

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => voidFunction to execute for each element

Returns

CommandStore

Inherited from

AliasStore.each

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:279

each<T>(fn, thisArg): CommandStore

Type parameters

Name
T

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => void
thisArgT

Returns

CommandStore

Inherited from

AliasStore.each

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:280


entries

entries(): IterableIterator<[string, Command<Args, CommandOptions>]>

Returns an iterable of key, value pairs for every entry in the map.

Returns

IterableIterator<[string, Command<Args, CommandOptions>]>

Inherited from

AliasStore.entries

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:126


equals

equals(collection): boolean

Checks if this collection shares identical items with another. This is different to checking for equality using equal-signs, because the collections may be different objects, but contain the same data.

Parameters

NameTypeDescription
collectionCollection<string, Command<Args, CommandOptions>>Collection to compare with

Returns

boolean

Whether the collections have identical contents

Inherited from

AliasStore.equals

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:320


every

every<K2>(fn): this is Collection<K2, Command<Args, CommandOptions>>

Checks if all items passes a test. Identical in behavior to Array.every().

example collection.every(user => !user.bot);

Type parameters

NameType
K2extends string

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => key is K2Function used to test (should return a boolean)

Returns

this is Collection<K2, Command<Args, CommandOptions>>

Inherited from

AliasStore.every

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:247

every<V2>(fn): this is Collection<string, V2>

Type parameters

NameType
V2extends Command<Args, CommandOptions, V2>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => value is V2

Returns

this is Collection<string, V2>

Inherited from

AliasStore.every

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:248

every(fn): boolean

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean

Returns

boolean

Inherited from

AliasStore.every

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:249

every<This, K2>(fn, thisArg): this is Collection<K2, Command<Args, CommandOptions>>

Type parameters

NameType
ThisThis
K2extends string

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => key is K2
thisArgThis

Returns

this is Collection<K2, Command<Args, CommandOptions>>

Inherited from

AliasStore.every

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:250

every<This, V2>(fn, thisArg): this is Collection<string, V2>

Type parameters

NameType
ThisThis
V2extends Command<Args, CommandOptions, V2>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => value is V2
thisArgThis

Returns

this is Collection<string, V2>

Inherited from

AliasStore.every

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:251

every<This>(fn, thisArg): boolean

Type parameters

Name
This

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean
thisArgThis

Returns

boolean

Inherited from

AliasStore.every

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:252


filter

filter<K2>(fn): Collection<K2, Command<Args, CommandOptions>>

Identical to Array.filter(), but returns a Collection instead of an Array.

example collection.filter(user => user.username === 'Bob');

Type parameters

NameType
K2extends string

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => key is K2The function to test with (should return boolean)

Returns

Collection<K2, Command<Args, CommandOptions>>

Inherited from

AliasStore.filter

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:167

filter<V2>(fn): Collection<string, V2>

Type parameters

NameType
V2extends Command<Args, CommandOptions, V2>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => value is V2

Returns

Collection<string, V2>

Inherited from

AliasStore.filter

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:168

filter(fn): Collection<string, Command<Args, CommandOptions>>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean

Returns

Collection<string, Command<Args, CommandOptions>>

Inherited from

AliasStore.filter

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:169

filter<This, K2>(fn, thisArg): Collection<K2, Command<Args, CommandOptions>>

Type parameters

NameType
ThisThis
K2extends string

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => key is K2
thisArgThis

Returns

Collection<K2, Command<Args, CommandOptions>>

Inherited from

AliasStore.filter

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:170

filter<This, V2>(fn, thisArg): Collection<string, V2>

Type parameters

NameType
ThisThis
V2extends Command<Args, CommandOptions, V2>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => value is V2
thisArgThis

Returns

Collection<string, V2>

Inherited from

AliasStore.filter

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:171

filter<This>(fn, thisArg): Collection<string, Command<Args, CommandOptions>>

Type parameters

Name
This

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean
thisArgThis

Returns

Collection<string, Command<Args, CommandOptions>>

Inherited from

AliasStore.filter

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:172


find

find<V2>(fn): undefined | V2

Searches for a single item where the given function returns a truthy value. This behaves like Array.find().

All collections used in Discord.js are mapped using their `id` property, and if you want to find by id you should use the `get` method. See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get) for details.

example collection.find(user => user.username === 'Bob');

Type parameters

NameType
V2extends Command<Args, CommandOptions, V2>

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => value is V2The function to test with (should return boolean)

Returns

undefined | V2

Inherited from

AliasStore.find

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:127

find(fn): undefined | Command<Args, CommandOptions>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean

Returns

undefined | Command<Args, CommandOptions>

Inherited from

AliasStore.find

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:128

find<This, V2>(fn, thisArg): undefined | V2

Type parameters

NameType
ThisThis
V2extends Command<Args, CommandOptions, V2>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => value is V2
thisArgThis

Returns

undefined | V2

Inherited from

AliasStore.find

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:129

find<This>(fn, thisArg): undefined | Command<Args, CommandOptions>

Type parameters

Name
This

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean
thisArgThis

Returns

undefined | Command<Args, CommandOptions>

Inherited from

AliasStore.find

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:130


findKey

findKey<K2>(fn): undefined | K2

Searches for the key of a single item where the given function returns a truthy value. This behaves like Array.findIndex(), but returns the key rather than the positional index.

example collection.findKey(user => user.username === 'Bob');

Type parameters

NameType
K2extends string

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => key is K2The function to test with (should return boolean)

Returns

undefined | K2

Inherited from

AliasStore.findKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:142

findKey(fn): undefined | string

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean

Returns

undefined | string

Inherited from

AliasStore.findKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:143

findKey<This, K2>(fn, thisArg): undefined | K2

Type parameters

NameType
ThisThis
K2extends string

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => key is K2
thisArgThis

Returns

undefined | K2

Inherited from

AliasStore.findKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:144

findKey<This>(fn, thisArg): undefined | string

Type parameters

Name
This

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean
thisArgThis

Returns

undefined | string

Inherited from

AliasStore.findKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:145


first

first(): undefined | Command<Args, CommandOptions>

Obtains the first value(s) in this collection.

Returns

undefined | Command<Args, CommandOptions>

A single value if no amount is provided or an array of values, starting from the end if amount is negative

Inherited from

AliasStore.first

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:48

first(amount): Command<Args, CommandOptions>[]

Parameters

NameType
amountnumber

Returns

Command<Args, CommandOptions>[]

Inherited from

AliasStore.first

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:49


firstKey

firstKey(): undefined | string

Obtains the first key(s) in this collection.

Returns

undefined | string

A single key if no amount is provided or an array of keys, starting from the end if amount is negative

Inherited from

AliasStore.firstKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:58

firstKey(amount): string[]

Parameters

NameType
amountnumber

Returns

string[]

Inherited from

AliasStore.firstKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:59


flatMap

flatMap<T>(fn): Collection<string, T>

Maps each item into a Collection, then joins the results into a single Collection. Identical in behavior to Array.flatMap().

example collection.flatMap(guild => guild.members.cache);

Type parameters

Name
T

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => Collection<string, T>Function that produces a new Collection

Returns

Collection<string, T>

Inherited from

AliasStore.flatMap

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:199

flatMap<T, This>(fn, thisArg): Collection<string, T>

Type parameters

Name
T
This

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => Collection<string, T>
thisArgThis

Returns

Collection<string, T>

Inherited from

AliasStore.flatMap

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:200


forEach

forEach(callbackfn, thisArg?): void

Parameters

NameType
callbackfn(value: Command<Args, CommandOptions>, key: string, map: Map<string, Command<Args, CommandOptions>>) => void
thisArg?any

Returns

void

Inherited from

AliasStore.forEach

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:24


get

get(key): undefined | Command<Args, CommandOptions>

Looks up the name by the store, falling back to an alias lookup.

Parameters

NameTypeDescription
keystringThe key to look for.

Returns

undefined | Command<Args, CommandOptions>

Inherited from

AliasStore.get

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:717


has

has(key): boolean

Checks whether a key is in the store, or is an alias

Parameters

NameTypeDescription
keystringThe key to check

Returns

boolean

Inherited from

AliasStore.has

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:722


hasAll

hasAll(...keys): boolean

Checks if all of the elements exist in the collection.

Parameters

NameTypeDescription
...keysstring[]The keys of the elements to check for

Returns

boolean

true if all of the elements exist, false if at least one does not exist.

Inherited from

AliasStore.hasAll

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:32


hasAny

hasAny(...keys): boolean

Checks if any of the elements exist in the collection.

Parameters

NameTypeDescription
...keysstring[]The keys of the elements to check for

Returns

boolean

true if any of the elements exist, false if none exist.

Inherited from

AliasStore.hasAny

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:40


insert

insert(piece): Promise<Command<Args, CommandOptions>>

Inserts a piece into the store, and adds all the aliases.

Parameters

NameType
pieceCommand<Args, CommandOptions>

Returns

Promise<Command<Args, CommandOptions>>

The inserted piece.

Overrides

AliasStore.insert

Defined in

projects/framework/src/lib/structures/CommandStore.ts:24


intersect

intersect(other): Collection<string, Command<Args, CommandOptions>>

The intersect method returns a new structure containing items where the keys are present in both original structures.

Parameters

NameTypeDescription
otherCollection<string, Command<Args, CommandOptions>>The other Collection to filter against

Returns

Collection<string, Command<Args, CommandOptions>>

Inherited from

AliasStore.intersect

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:338


keyAt

keyAt(index?): undefined | string

Identical to Array.at(). Returns the key at a given index, allowing for positive and negative integers. Negative integers count back from the last item in the collection.

Parameters

NameTypeDescription
index?numberThe index of the key to obtain

Returns

undefined | string

Inherited from

AliasStore.keyAt

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:95


keys

keys(): IterableIterator<string>

Returns an iterable of keys in the map

Returns

IterableIterator<string>

Inherited from

AliasStore.keys

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:131


last

last(): undefined | Command<Args, CommandOptions>

Obtains the last value(s) in this collection.

Returns

undefined | Command<Args, CommandOptions>

A single value if no amount is provided or an array of values, starting from the start if amount is negative

Inherited from

AliasStore.last

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:68

last(amount): Command<Args, CommandOptions>[]

Parameters

NameType
amountnumber

Returns

Command<Args, CommandOptions>[]

Inherited from

AliasStore.last

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:69


lastKey

lastKey(): undefined | string

Obtains the last key(s) in this collection.

Returns

undefined | string

A single key if no amount is provided or an array of keys, starting from the start if amount is negative

Inherited from

AliasStore.lastKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:78

lastKey(amount): string[]

Parameters

NameType
amountnumber

Returns

string[]

Inherited from

AliasStore.lastKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:79


load

load(root, path): Promise<Command<Args, CommandOptions>[]>

Loads one or more pieces from a path.

Parameters

NameTypeDescription
rootstringThe root directory the file is from.
pathstringThe path of the file to load, relative to the root.

Returns

Promise<Command<Args, CommandOptions>[]>

All the loaded pieces.

Inherited from

AliasStore.load

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:312


loadAll

loadAll(): Promise<void>

Loads all pieces from all directories specified by paths.

Returns

Promise<void>

Overrides

AliasStore.loadAll

Defined in

projects/framework/src/lib/structures/CommandStore.ts:60


map

map<T>(fn): T[]

Maps each item to another value into an array. Identical in behavior to Array.map().

example collection.map(user => user.tag);

Type parameters

Name
T

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => TFunction that produces an element of the new array, taking three arguments

Returns

T[]

Inherited from

AliasStore.map

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:211

map<This, T>(fn, thisArg): T[]

Type parameters

Name
This
T

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => T
thisArgThis

Returns

T[]

Inherited from

AliasStore.map

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:212


mapValues

mapValues<T>(fn): Collection<string, T>

Maps each item to another value into a collection. Identical in behavior to Array.map().

example collection.mapValues(user => user.tag);

Type parameters

Name
T

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => TFunction that produces an element of the new collection, taking three arguments

Returns

Collection<string, T>

Inherited from

AliasStore.mapValues

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:223

mapValues<This, T>(fn, thisArg): Collection<string, T>

Type parameters

Name
This
T

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => T
thisArgThis

Returns

Collection<string, T>

Inherited from

AliasStore.mapValues

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:224


partition

partition<K2>(fn): [Collection<K2, Command<Args, CommandOptions>>, Collection<Exclude<string, K2>, Command<Args, CommandOptions>>]

Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.

example const [big, small] = collection.partition(guild => guild.memberCount > 250);

Type parameters

NameType
K2extends string

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => key is K2Function used to test (should return a boolean)

Returns

[Collection<K2, Command<Args, CommandOptions>>, Collection<Exclude<string, K2>, Command<Args, CommandOptions>>]

Inherited from

AliasStore.partition

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:183

partition<V2>(fn): [Collection<string, V2>, Collection<string, Exclude<Command<Args, CommandOptions>, V2>>]

Type parameters

NameType
V2extends Command<Args, CommandOptions, V2>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => value is V2

Returns

[Collection<string, V2>, Collection<string, Exclude<Command<Args, CommandOptions>, V2>>]

Inherited from

AliasStore.partition

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:184

partition(fn): [Collection<string, Command<Args, CommandOptions>>, Collection<string, Command<Args, CommandOptions>>]

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean

Returns

[Collection<string, Command<Args, CommandOptions>>, Collection<string, Command<Args, CommandOptions>>]

Inherited from

AliasStore.partition

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:185

partition<This, K2>(fn, thisArg): [Collection<K2, Command<Args, CommandOptions>>, Collection<Exclude<string, K2>, Command<Args, CommandOptions>>]

Type parameters

NameType
ThisThis
K2extends string

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => key is K2
thisArgThis

Returns

[Collection<K2, Command<Args, CommandOptions>>, Collection<Exclude<string, K2>, Command<Args, CommandOptions>>]

Inherited from

AliasStore.partition

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:186

partition<This, V2>(fn, thisArg): [Collection<string, V2>, Collection<string, Exclude<Command<Args, CommandOptions>, V2>>]

Type parameters

NameType
ThisThis
V2extends Command<Args, CommandOptions, V2>

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => value is V2
thisArgThis

Returns

[Collection<string, V2>, Collection<string, Exclude<Command<Args, CommandOptions>, V2>>]

Inherited from

AliasStore.partition

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:187

partition<This>(fn, thisArg): [Collection<string, Command<Args, CommandOptions>>, Collection<string, Command<Args, CommandOptions>>]

Type parameters

Name
This

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean
thisArgThis

Returns

[Collection<string, Command<Args, CommandOptions>>, Collection<string, Command<Args, CommandOptions>>]

Inherited from

AliasStore.partition

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:188


random

random(): undefined | Command<Args, CommandOptions>

Obtains unique random value(s) from this collection.

Returns

undefined | Command<Args, CommandOptions>

A single value if no amount is provided or an array of values

Inherited from

AliasStore.random

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:103

random(amount): Command<Args, CommandOptions>[]

Parameters

NameType
amountnumber

Returns

Command<Args, CommandOptions>[]

Inherited from

AliasStore.random

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:104


randomKey

randomKey(): undefined | string

Obtains unique random key(s) from this collection.

Returns

undefined | string

A single key if no amount is provided or an array

Inherited from

AliasStore.randomKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:112

randomKey(amount): string[]

Parameters

NameType
amountnumber

Returns

string[]

Inherited from

AliasStore.randomKey

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:113


reduce

reduce<T>(fn, initialValue?): T

Applies a function to produce a single value. Identical in behavior to Array.reduce().

example collection.reduce((acc, guild) => acc + guild.memberCount, 0);

Type parameters

Name
T

Parameters

NameTypeDescription
fn(accumulator: T, value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => TFunction used to reduce, taking four arguments; accumulator, currentValue, currentKey, and collection
initialValue?TStarting value for the accumulator

Returns

T

Inherited from

AliasStore.reduce

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:264


registerPath

registerPath(path): CommandStore

Registers a directory into the store.

example

store
.registerPath(resolve('commands'))
.registerPath(resolve('third-party', 'commands'));

Parameters

NameTypeDescription
pathstringThe path to be added.

Returns

CommandStore

Inherited from

AliasStore.registerPath

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:305


resolve

resolve(name): Command<Args, CommandOptions>

Resolves a piece by its name or its instance.

Parameters

NameTypeDescription
namestring | Command<Args, CommandOptions>The name of the piece or the instance itself.

Returns

Command<Args, CommandOptions>

The resolved piece.

Inherited from

AliasStore.resolve

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:332


set

set(key, value): CommandStore

Parameters

NameType
keystring
valueCommand<Args, CommandOptions>

Returns

CommandStore

Inherited from

AliasStore.set

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:27


some

some(fn): boolean

Checks if there exists an item that passes a test. Identical in behavior to Array.some().

example collection.some(user => user.discriminator === '0000');

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => booleanFunction used to test (should return a boolean)

Returns

boolean

Inherited from

AliasStore.some

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:235

some<T>(fn, thisArg): boolean

Type parameters

Name
T

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean
thisArgT

Returns

boolean

Inherited from

AliasStore.some

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:236


sort

sort(compareFunction?): CommandStore

The sort method sorts the items of a collection in place and returns it. The sort is not necessarily stable in Node 10 or older. The default sort order is according to string Unicode code points.

example collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);

Parameters

NameTypeDescription
compareFunction?Comparator<string, Command<Args, CommandOptions>>Specifies a function that defines the sort order. If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.

Returns

CommandStore

Inherited from

AliasStore.sort

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:332


sorted

sorted(compareFunction?): Collection<string, Command<Args, CommandOptions>>

The sorted method sorts the items of a collection and returns it. The sort is not necessarily stable in Node 10 or older. The default sort order is according to string Unicode code points.

example collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);

Parameters

NameTypeDescription
compareFunction?Comparator<string, Command<Args, CommandOptions>>Specifies a function that defines the sort order. If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.

Returns

Collection<string, Command<Args, CommandOptions>>

Inherited from

AliasStore.sorted

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:357


sweep

sweep(fn): number

Removes items that satisfy the provided filter function.

Parameters

NameTypeDescription
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => booleanFunction used to test (should return a boolean)

Returns

number

The number of removed entries

Inherited from

AliasStore.sweep

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:154

sweep<T>(fn, thisArg): number

Type parameters

Name
T

Parameters

NameType
fn(value: Command<Args, CommandOptions>, key: string, collection: CommandStore) => boolean
thisArgT

Returns

number

Inherited from

AliasStore.sweep

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:155


tap

tap(fn): CommandStore

Runs a function on the collection and returns the collection.

example collection .tap(coll => console.log(coll.size)) .filter(user => user.bot) .tap(coll => console.log(coll.size))

Parameters

NameTypeDescription
fn(collection: CommandStore) => voidFunction to execute

Returns

CommandStore

Inherited from

AliasStore.tap

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:293

tap<T>(fn, thisArg): CommandStore

Type parameters

Name
T

Parameters

NameType
fn(collection: CommandStore) => void
thisArgT

Returns

CommandStore

Inherited from

AliasStore.tap

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:294


toJSON

toJSON(): Command<Args, CommandOptions>[]

Returns

Command<Args, CommandOptions>[]

Inherited from

AliasStore.toJSON

Defined in

node_modules/@sapphire/pieces/node_modules/@discordjs/collection/dist/index.d.ts:358


unload

unload(name): Promise<Command<Args, CommandOptions>>

Unloads a piece given its instance or its name, and removes all the aliases.

Parameters

NameType
namestring | Command<Args, CommandOptions>

Returns

Promise<Command<Args, CommandOptions>>

Returns the piece that was unloaded.

Overrides

AliasStore.unload

Defined in

projects/framework/src/lib/structures/CommandStore.ts:34


unloadAll

unloadAll(): Promise<Command<Args, CommandOptions>[]>

Unloads all pieces from the store.

Returns

Promise<Command<Args, CommandOptions>[]>

Inherited from

AliasStore.unloadAll

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:322


values

values(): IterableIterator<Command<Args, CommandOptions>>

Returns an iterable of values in the map

Returns

IterableIterator<Command<Args, CommandOptions>>

Inherited from

AliasStore.values

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:136