Skip to main content

Class: PreconditionStore

Hierarchy​

Constructors​

constructor​

β€’ new PreconditionStore()

Overrides​

Store.constructor

Defined in​

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

Properties​

Constructor​

β€’ Readonly Constructor: Constructor<Precondition<PreconditionOptions>>

Inherited from​

Store.Constructor

Defined in​

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


[toStringTag]​

β€’ Readonly [toStringTag]: string

Inherited from​

Store.[toStringTag]

Defined in​

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


constructor​

β€’ constructor: CollectionConstructor

Inherited from​

Store.constructor

Defined in​

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


globalPreconditions​

β€’ Private Readonly globalPreconditions: Precondition<PreconditionOptions>[] = []

Defined in​

projects/framework/src/lib/structures/PreconditionStore.ts:9


name​

β€’ Readonly name: string

Inherited from​

Store.name

Defined in​

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


paths​

β€’ Readonly paths: Set<string>

Inherited from​

Store.paths

Defined in​

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


size​

β€’ Readonly size: number

Inherited from​

Store.size

Defined in​

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


strategy​

β€’ Readonly strategy: ILoaderStrategy<Precondition<PreconditionOptions>>

Inherited from​

Store.strategy

Defined in​

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


[species]​

β–ͺ Static Readonly [species]: MapConstructor

Inherited from​

Store.[species]

Defined in​

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


default​

β–ͺ Static Readonly default: typeof Collection

Inherited from​

Store.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​

Store.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​

Store.logger

Defined in​

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

Accessors​

container​

β€’ get container(): Container

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

see container

Returns​

Container

Inherited from​

Store.container

Defined in​

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

Methods​

[iterator]​

β–Έ [iterator](): IterableIterator<[string, Precondition<PreconditionOptions>]>

Returns an iterable of entries in the map.

Returns​

IterableIterator<[string, Precondition<PreconditionOptions>]>

Inherited from​

Store.[iterator]

Defined in​

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


at​

β–Έ at(index?): undefined | Precondition<PreconditionOptions>

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 | Precondition<PreconditionOptions>

Inherited from​

Store.at

Defined in​

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


chatInputRun​

β–Έ chatInputRun(interaction, command, context?): AsyncPreconditionResult

Parameters​

NameType
interactionCommandInteraction<CacheType>
commandChatInputCommand
contextPreconditionContext

Returns​

AsyncPreconditionResult

Defined in​

projects/framework/src/lib/structures/PreconditionStore.ts:30


clear​

β–Έ clear(): void

Returns​

void

Overrides​

Store.clear

Defined in​

projects/framework/src/lib/structures/PreconditionStore.ts:89


clone​

β–Έ clone(): Collection<string, Precondition<PreconditionOptions>>

Creates an identical shallow copy of this collection.

example const newColl = someColl.clone();

Returns​

Collection<string, Precondition<PreconditionOptions>>

Inherited from​

Store.clone

Defined in​

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


concat​

β–Έ concat(...collections): Collection<string, Precondition<PreconditionOptions>>

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, Precondition<PreconditionOptions>>[]Collections to merge

Returns​

Collection<string, Precondition<PreconditionOptions>>

Inherited from​

Store.concat

Defined in​

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


construct​

β–Έ construct(Ctor, data): Precondition<PreconditionOptions>

Constructs a Piece instance.

Parameters​

NameTypeDescription
CtorILoaderResultEntry<Precondition<PreconditionOptions>>The Piece's constructor used to build the instance.
dataHydratedModuleDataThe module's information

Returns​

Precondition<PreconditionOptions>

An instance of the constructed piece.

Inherited from​

Store.construct

Defined in​

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


contextMenuRun​

β–Έ contextMenuRun(interaction, command, context?): AsyncPreconditionResult

Parameters​

NameType
interactionContextMenuInteraction<CacheType>
commandContextMenuCommand
contextPreconditionContext

Returns​

AsyncPreconditionResult

Defined in​

projects/framework/src/lib/structures/PreconditionStore.ts:49


delete​

β–Έ delete(key): boolean

Parameters​

NameType
keystring

Returns​

boolean

Overrides​

Store.delete

Defined in​

projects/framework/src/lib/structures/PreconditionStore.ts:80


difference​

β–Έ difference(other): Collection<string, Precondition<PreconditionOptions>>

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, Precondition<PreconditionOptions>>The other Collection to filter against

Returns​

Collection<string, Precondition<PreconditionOptions>>

Inherited from​

Store.difference

Defined in​

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


each​

β–Έ each(fn): PreconditionStore

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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => voidFunction to execute for each element

Returns​

PreconditionStore

Inherited from​

Store.each

Defined in​

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

β–Έ each<T>(fn, thisArg): PreconditionStore

Type parameters​

Name
T

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => void
thisArgT

Returns​

PreconditionStore

Inherited from​

Store.each

Defined in​

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


entries​

β–Έ entries(): IterableIterator<[string, Precondition<PreconditionOptions>]>

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

Returns​

IterableIterator<[string, Precondition<PreconditionOptions>]>

Inherited from​

Store.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, Precondition<PreconditionOptions>>Collection to compare with

Returns​

boolean

Whether the collections have identical contents

Inherited from​

Store.equals

Defined in​

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


every​

β–Έ every<K2>(fn): this is Collection<K2, Precondition<PreconditionOptions>>

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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => key is K2Function used to test (should return a boolean)

Returns​

this is Collection<K2, Precondition<PreconditionOptions>>

Inherited from​

Store.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 Precondition<PreconditionOptions, V2>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => value is V2

Returns​

this is Collection<string, V2>

Inherited from​

Store.every

Defined in​

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

β–Έ every(fn): boolean

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean

Returns​

boolean

Inherited from​

Store.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, Precondition<PreconditionOptions>>

Type parameters​

NameType
ThisThis
K2extends string

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => key is K2
thisArgThis

Returns​

this is Collection<K2, Precondition<PreconditionOptions>>

Inherited from​

Store.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 Precondition<PreconditionOptions, V2>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => value is V2
thisArgThis

Returns​

this is Collection<string, V2>

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean
thisArgThis

Returns​

boolean

Inherited from​

Store.every

Defined in​

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


filter​

β–Έ filter<K2>(fn): Collection<K2, Precondition<PreconditionOptions>>

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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => key is K2The function to test with (should return boolean)

Returns​

Collection<K2, Precondition<PreconditionOptions>>

Inherited from​

Store.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 Precondition<PreconditionOptions, V2>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => value is V2

Returns​

Collection<string, V2>

Inherited from​

Store.filter

Defined in​

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

β–Έ filter(fn): Collection<string, Precondition<PreconditionOptions>>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean

Returns​

Collection<string, Precondition<PreconditionOptions>>

Inherited from​

Store.filter

Defined in​

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

β–Έ filter<This, K2>(fn, thisArg): Collection<K2, Precondition<PreconditionOptions>>

Type parameters​

NameType
ThisThis
K2extends string

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => key is K2
thisArgThis

Returns​

Collection<K2, Precondition<PreconditionOptions>>

Inherited from​

Store.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 Precondition<PreconditionOptions, V2>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => value is V2
thisArgThis

Returns​

Collection<string, V2>

Inherited from​

Store.filter

Defined in​

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

β–Έ filter<This>(fn, thisArg): Collection<string, Precondition<PreconditionOptions>>

Type parameters​

Name
This

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean
thisArgThis

Returns​

Collection<string, Precondition<PreconditionOptions>>

Inherited from​

Store.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 Precondition<PreconditionOptions, V2>

Parameters​

NameTypeDescription
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => value is V2The function to test with (should return boolean)

Returns​

undefined | V2

Inherited from​

Store.find

Defined in​

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

β–Έ find(fn): undefined | Precondition<PreconditionOptions>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean

Returns​

undefined | Precondition<PreconditionOptions>

Inherited from​

Store.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 Precondition<PreconditionOptions, V2>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => value is V2
thisArgThis

Returns​

undefined | V2

Inherited from​

Store.find

Defined in​

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

β–Έ find<This>(fn, thisArg): undefined | Precondition<PreconditionOptions>

Type parameters​

Name
This

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean
thisArgThis

Returns​

undefined | Precondition<PreconditionOptions>

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => key is K2The function to test with (should return boolean)

Returns​

undefined | K2

Inherited from​

Store.findKey

Defined in​

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

β–Έ findKey(fn): undefined | string

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean

Returns​

undefined | string

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => key is K2
thisArgThis

Returns​

undefined | K2

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean
thisArgThis

Returns​

undefined | string

Inherited from​

Store.findKey

Defined in​

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


first​

β–Έ first(): undefined | Precondition<PreconditionOptions>

Obtains the first value(s) in this collection.

Returns​

undefined | Precondition<PreconditionOptions>

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

Inherited from​

Store.first

Defined in​

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

β–Έ first(amount): Precondition<PreconditionOptions>[]

Parameters​

NameType
amountnumber

Returns​

Precondition<PreconditionOptions>[]

Inherited from​

Store.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​

Store.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​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => Collection<string, T>Function that produces a new Collection

Returns​

Collection<string, T>

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => Collection<string, T>
thisArgThis

Returns​

Collection<string, T>

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, map: Map<string, Precondition<PreconditionOptions>>) => void
thisArg?any

Returns​

void

Inherited from​

Store.forEach

Defined in​

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


get​

β–Έ get(key): undefined | Precondition<PreconditionOptions>

Parameters​

NameType
keystring

Returns​

undefined | Precondition<PreconditionOptions>

Inherited from​

Store.get

Defined in​

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


has​

β–Έ has(key): boolean

Parameters​

NameType
keystring

Returns​

boolean

Inherited from​

Store.has

Defined in​

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


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​

Store.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​

Store.hasAny

Defined in​

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


insert​

β–Έ insert(piece): Promise<Precondition<PreconditionOptions>>

Inserts a piece into the store.

Parameters​

NameTypeDescription
piecePrecondition<PreconditionOptions>The piece to be inserted into the store.

Returns​

Promise<Precondition<PreconditionOptions>>

The inserted piece.

Inherited from​

Store.insert

Defined in​

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


intersect​

β–Έ intersect(other): Collection<string, Precondition<PreconditionOptions>>

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

Parameters​

NameTypeDescription
otherCollection<string, Precondition<PreconditionOptions>>The other Collection to filter against

Returns​

Collection<string, Precondition<PreconditionOptions>>

Inherited from​

Store.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​

Store.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​

Store.keys

Defined in​

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


last​

β–Έ last(): undefined | Precondition<PreconditionOptions>

Obtains the last value(s) in this collection.

Returns​

undefined | Precondition<PreconditionOptions>

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

Inherited from​

Store.last

Defined in​

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

β–Έ last(amount): Precondition<PreconditionOptions>[]

Parameters​

NameType
amountnumber

Returns​

Precondition<PreconditionOptions>[]

Inherited from​

Store.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​

Store.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​

Store.lastKey

Defined in​

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


load​

β–Έ load(root, path): Promise<Precondition<PreconditionOptions>[]>

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<Precondition<PreconditionOptions>[]>

All the loaded pieces.

Inherited from​

Store.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>

Inherited from​

Store.loadAll

Defined in​

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


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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => TFunction that produces an element of the new array, taking three arguments

Returns​

T[]

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => T
thisArgThis

Returns​

T[]

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => TFunction that produces an element of the new collection, taking three arguments

Returns​

Collection<string, T>

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => T
thisArgThis

Returns​

Collection<string, T>

Inherited from​

Store.mapValues

Defined in​

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


messageRun​

β–Έ messageRun(message, command, context?): AsyncPreconditionResult

Parameters​

NameType
messageMessage<boolean>
commandMessageCommand
contextPreconditionContext

Returns​

AsyncPreconditionResult

Defined in​

projects/framework/src/lib/structures/PreconditionStore.ts:15


partition​

β–Έ partition<K2>(fn): [Collection<K2, Precondition<PreconditionOptions>>, Collection<Exclude<string, K2>, Precondition<PreconditionOptions>>]

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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => key is K2Function used to test (should return a boolean)

Returns​

[Collection<K2, Precondition<PreconditionOptions>>, Collection<Exclude<string, K2>, Precondition<PreconditionOptions>>]

Inherited from​

Store.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<Precondition<PreconditionOptions>, V2>>]

Type parameters​

NameType
V2extends Precondition<PreconditionOptions, V2>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => value is V2

Returns​

[Collection<string, V2>, Collection<string, Exclude<Precondition<PreconditionOptions>, V2>>]

Inherited from​

Store.partition

Defined in​

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

β–Έ partition(fn): [Collection<string, Precondition<PreconditionOptions>>, Collection<string, Precondition<PreconditionOptions>>]

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean

Returns​

[Collection<string, Precondition<PreconditionOptions>>, Collection<string, Precondition<PreconditionOptions>>]

Inherited from​

Store.partition

Defined in​

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

β–Έ partition<This, K2>(fn, thisArg): [Collection<K2, Precondition<PreconditionOptions>>, Collection<Exclude<string, K2>, Precondition<PreconditionOptions>>]

Type parameters​

NameType
ThisThis
K2extends string

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => key is K2
thisArgThis

Returns​

[Collection<K2, Precondition<PreconditionOptions>>, Collection<Exclude<string, K2>, Precondition<PreconditionOptions>>]

Inherited from​

Store.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<Precondition<PreconditionOptions>, V2>>]

Type parameters​

NameType
ThisThis
V2extends Precondition<PreconditionOptions, V2>

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => value is V2
thisArgThis

Returns​

[Collection<string, V2>, Collection<string, Exclude<Precondition<PreconditionOptions>, V2>>]

Inherited from​

Store.partition

Defined in​

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

β–Έ partition<This>(fn, thisArg): [Collection<string, Precondition<PreconditionOptions>>, Collection<string, Precondition<PreconditionOptions>>]

Type parameters​

Name
This

Parameters​

NameType
fn(value: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean
thisArgThis

Returns​

[Collection<string, Precondition<PreconditionOptions>>, Collection<string, Precondition<PreconditionOptions>>]

Inherited from​

Store.partition

Defined in​

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


random​

β–Έ random(): undefined | Precondition<PreconditionOptions>

Obtains unique random value(s) from this collection.

Returns​

undefined | Precondition<PreconditionOptions>

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

Inherited from​

Store.random

Defined in​

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

β–Έ random(amount): Precondition<PreconditionOptions>[]

Parameters​

NameType
amountnumber

Returns​

Precondition<PreconditionOptions>[]

Inherited from​

Store.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​

Store.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​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => TFunction used to reduce, taking four arguments; accumulator, currentValue, currentKey, and collection
initialValue?TStarting value for the accumulator

Returns​

T

Inherited from​

Store.reduce

Defined in​

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


registerPath​

β–Έ registerPath(path): PreconditionStore

Registers a directory into the store.

example

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

Parameters​

NameTypeDescription
pathstringThe path to be added.

Returns​

PreconditionStore

Inherited from​

Store.registerPath

Defined in​

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


resolve​

β–Έ resolve(name): Precondition<PreconditionOptions>

Resolves a piece by its name or its instance.

Parameters​

NameTypeDescription
namestring | Precondition<PreconditionOptions>The name of the piece or the instance itself.

Returns​

Precondition<PreconditionOptions>

The resolved piece.

Inherited from​

Store.resolve

Defined in​

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


set​

β–Έ set(key, value): PreconditionStore

Parameters​

NameType
keystring
valuePrecondition<PreconditionOptions>

Returns​

PreconditionStore

Overrides​

Store.set

Defined in​

projects/framework/src/lib/structures/PreconditionStore.ts:68


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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => booleanFunction used to test (should return a boolean)

Returns​

boolean

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean
thisArgT

Returns​

boolean

Inherited from​

Store.some

Defined in​

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


sort​

β–Έ sort(compareFunction?): PreconditionStore

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, Precondition<PreconditionOptions>>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​

PreconditionStore

Inherited from​

Store.sort

Defined in​

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


sorted​

β–Έ sorted(compareFunction?): Collection<string, Precondition<PreconditionOptions>>

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, Precondition<PreconditionOptions>>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, Precondition<PreconditionOptions>>

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => booleanFunction used to test (should return a boolean)

Returns​

number

The number of removed entries

Inherited from​

Store.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: Precondition<PreconditionOptions>, key: string, collection: PreconditionStore) => boolean
thisArgT

Returns​

number

Inherited from​

Store.sweep

Defined in​

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


tap​

β–Έ tap(fn): PreconditionStore

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: PreconditionStore) => voidFunction to execute

Returns​

PreconditionStore

Inherited from​

Store.tap

Defined in​

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

β–Έ tap<T>(fn, thisArg): PreconditionStore

Type parameters​

Name
T

Parameters​

NameType
fn(collection: PreconditionStore) => void
thisArgT

Returns​

PreconditionStore

Inherited from​

Store.tap

Defined in​

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


toJSON​

β–Έ toJSON(): Precondition<PreconditionOptions>[]

Returns​

Precondition<PreconditionOptions>[]

Inherited from​

Store.toJSON

Defined in​

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


unload​

β–Έ unload(name): Promise<Precondition<PreconditionOptions>>

Unloads a piece given its instance or its name.

Parameters​

NameTypeDescription
namestring | Precondition<PreconditionOptions>The name of the file to load.

Returns​

Promise<Precondition<PreconditionOptions>>

Returns the piece that was unloaded.

Inherited from​

Store.unload

Defined in​

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


unloadAll​

β–Έ unloadAll(): Promise<Precondition<PreconditionOptions>[]>

Unloads all pieces from the store.

Returns​

Promise<Precondition<PreconditionOptions>[]>

Inherited from​

Store.unloadAll

Defined in​

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


values​

β–Έ values(): IterableIterator<Precondition<PreconditionOptions>>

Returns an iterable of values in the map

Returns​

IterableIterator<Precondition<PreconditionOptions>>

Inherited from​

Store.values

Defined in​

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