Class: ScheduledTaskStore
@sapphire/plugin-scheduled-tasks.ScheduledTaskStore
Hierarchy
Store
<ScheduledTask
>↳
ScheduledTaskStore
Constructors
constructor
• new ScheduledTaskStore()
Overrides
Store<ScheduledTask\>.constructor
Defined in
projects/plugins/packages/scheduled-tasks/src/lib/structures/ScheduledTaskStore.ts:7
Properties
Constructor
• Readonly
Constructor: AbstractConstructor
<ScheduledTask
>
Inherited from
Store.Constructor
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:284
[toStringTag]
• Readonly
[toStringTag]: string
Inherited from
Store.[toStringTag]
Defined in
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:137
constructor
• constructor: CollectionConstructor
Inherited from
Store.constructor
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:21
name
• Readonly
name: string
Inherited from
Store.name
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:285
paths
• Readonly
paths: Set
<string
>
Inherited from
Store.paths
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:286
repeatedTasks
• Readonly
repeatedTasks: ScheduledTask
[] = []
Defined in
projects/plugins/packages/scheduled-tasks/src/lib/structures/ScheduledTaskStore.ts:5
size
• Readonly
size: number
Inherited from
Store.size
Defined in
node_modules/typescript/lib/lib.es2015.collection.d.ts:46
strategy
• Readonly
strategy: ILoaderStrategy
<ScheduledTask
>
Inherited from
Store.strategy
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:287
[species]
▪ Static
Readonly
[species]: MapConstructor
Inherited from
Store.[species]
Defined in
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:319
defaultStrategy
▪ Static
defaultStrategy: ILoaderStrategy
<any
>
The default strategy, defaults to 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:372
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:376
Accessors
container
• get
container(): Container
A reference to the Container object for ease of use.
Returns
Container
See
container
Inherited from
Store.container
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:297
Methods
[iterator]
▸ [iterator](): IterableIterator
<[string
, ScheduledTask
]>
Returns an iterable of entries in the map.
Returns
IterableIterator
<[string
, ScheduledTask
]>
Inherited from
Store.[iterator]
Defined in
node_modules/typescript/lib/lib.es2015.iterable.d.ts:119
at
▸ at(index
): undefined
| ScheduledTask
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
Name | Type | Description |
---|---|---|
index | number | The index of the element to obtain |
Returns
undefined
| ScheduledTask
Inherited from
Store.at
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:98
clear
▸ clear(): void
Returns
void
Overrides
Store.clear
Defined in
projects/plugins/packages/scheduled-tasks/src/lib/structures/ScheduledTaskStore.ts:28
clone
▸ clone(): Collection
<string
, ScheduledTask
>
Creates an identical shallow copy of this collection.
Returns
Collection
<string
, ScheduledTask
>
Example
const newColl = someColl.clone();
Inherited from
Store.clone
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:328
concat
▸ concat(...collections
): Collection
<string
, ScheduledTask
>
Combines this collection with others into a new collection. None of the source collections are modified.
Parameters
Name | Type | Description |
---|---|---|
...collections | ReadonlyCollection <string , ScheduledTask >[] | Collections to merge |
Returns
Collection
<string
, ScheduledTask
>
Example
const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);
Inherited from
Store.concat
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:338
construct
▸ construct(Ctor
, data
): ScheduledTask
Constructs a Piece instance.
Parameters
Name | Type | Description |
---|---|---|
Ctor | ILoaderResultEntry <ScheduledTask > | The Piece's constructor used to build the instance. |
data | HydratedModuleData | The module's information |
Returns
An instance of the constructed piece.
Inherited from
Store.construct
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:348
delete
▸ delete(key
): boolean
Parameters
Name | Type |
---|---|
key | string |
Returns
boolean
Overrides
Store.delete
Defined in
projects/plugins/packages/scheduled-tasks/src/lib/structures/ScheduledTaskStore.ts:19
difference
▸ difference<T
>(other
): Collection
<string
, ScheduledTask
| T
>
The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
other | ReadonlyCollection <string , T > | The other Collection to filter against |
Returns
Collection
<string
, ScheduledTask
| T
>
Inherited from
Store.difference
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:378
each
▸ each(fn
): ScheduledTaskStore
Identical to Map.forEach(), but returns the collection instead of undefined.
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => void | Function to execute for each element |
Returns
Example
collection
.each(user => console.log(user.username))
.filter(user => user.bot)
.each(user => console.log(user.username));
Inherited from
Store.each
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:303
▸ each<T
>(fn
, thisArg
): ScheduledTaskStore
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
fn | (this : T , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => void |
thisArg | T |
Returns
Inherited from
Store.each
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:304
ensure
▸ ensure(key
, defaultValueGenerator
): ScheduledTask
Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator.
Parameters
Name | Type | Description |
---|---|---|
key | string | The key to get if it exists, or set otherwise |
defaultValueGenerator | (key : string , collection : ScheduledTaskStore ) => ScheduledTask | A function that generates the default value |
Returns
Example
collection.ensure(guildId, () => defaultGuildConfig);
Inherited from
Store.ensure
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:41
entries
▸ entries(): IterableIterator
<[string
, ScheduledTask
]>
Returns an iterable of key, value pairs for every entry in the map.
Returns
IterableIterator
<[string
, ScheduledTask
]>
Inherited from
Store.entries
Defined in
node_modules/typescript/lib/lib.es2015.iterable.d.ts:124
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
Name | Type | Description |
---|---|---|
collection | ReadonlyCollection <string , ScheduledTask > | Collection to compare with |
Returns
boolean
Whether the collections have identical contents
Inherited from
Store.equals
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:347
every
▸ every<K2
>(fn
): this is Collection<K2, ScheduledTask>
Checks if all items passes a test. Identical in behavior to Array.every().
Type parameters
Name | Type |
---|---|
K2 | extends string |
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => key is K2 | Function used to test (should return a boolean) |
Returns
this is Collection<K2, ScheduledTask>
Example
collection.every(user => !user.bot);
Inherited from
Store.every
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:269
▸ every<V2
>(fn
): this is Collection<string, V2>
Type parameters
Name | Type |
---|---|
V2 | extends ScheduledTask |
Parameters
Name | Type |
---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => value is V2 |
Returns
this is Collection<string, V2>
Inherited from
Store.every
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:270
▸ every(fn
): boolean
Parameters
Name | Type |
---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
Returns
boolean
Inherited from
Store.every
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:271
▸ every<This
, K2
>(fn
, thisArg
): this is Collection<K2, ScheduledTask>
Type parameters
Name | Type |
---|---|
This | This |
K2 | extends string |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => key is K2 |
thisArg | This |
Returns
this is Collection<K2, ScheduledTask>
Inherited from
Store.every
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:272
▸ every<This
, V2
>(fn
, thisArg
): this is Collection<string, V2>
Type parameters
Name | Type |
---|---|
This | This |
V2 | extends ScheduledTask |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => value is V2 |
thisArg | This |
Returns
this is Collection<string, V2>
Inherited from
Store.every
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:273
▸ every<This
>(fn
, thisArg
): boolean
Type parameters
Name |
---|
This |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
thisArg | This |
Returns
boolean
Inherited from
Store.every
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:274
filter
▸ filter<K2
>(fn
): Collection
<K2
, ScheduledTask
>
Identical to Array.filter(), but returns a Collection instead of an Array.
Type parameters
Name | Type |
---|---|
K2 | extends string |
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => key is K2 | The function to test with (should return boolean) |
Returns
Collection
<K2
, ScheduledTask
>
Example
collection.filter(user => user.username === 'Bob');
Inherited from
Store.filter
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:183
▸ filter<V2
>(fn
): Collection
<string
, V2
>
Type parameters
Name | Type |
---|---|
V2 | extends ScheduledTask |
Parameters
Name | Type |
---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => value is V2 |
Returns
Collection
<string
, V2
>
Inherited from
Store.filter
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:184
▸ filter(fn
): Collection
<string
, ScheduledTask
>
Parameters
Name | Type |
---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
Returns
Collection
<string
, ScheduledTask
>
Inherited from
Store.filter
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:185
▸ filter<This
, K2
>(fn
, thisArg
): Collection
<K2
, ScheduledTask
>
Type parameters
Name | Type |
---|---|
This | This |
K2 | extends string |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => key is K2 |
thisArg | This |
Returns
Collection
<K2
, ScheduledTask
>
Inherited from
Store.filter
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:186
▸ filter<This
, V2
>(fn
, thisArg
): Collection
<string
, V2
>
Type parameters
Name | Type |
---|---|
This | This |
V2 | extends ScheduledTask |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => value is V2 |
thisArg | This |
Returns
Collection
<string
, V2
>
Inherited from
Store.filter
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:187
▸ filter<This
>(fn
, thisArg
): Collection
<string
, ScheduledTask
>
Type parameters
Name |
---|
This |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
thisArg | This |
Returns
Collection
<string
, ScheduledTask
>
Inherited from
Store.filter
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:188
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 for details.
Type parameters
Name | Type |
---|---|
V2 | extends ScheduledTask |
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => value is V2 | The function to test with (should return boolean) |
Returns
undefined
| V2
Example
collection.find(user => user.username === 'Bob');
Inherited from
Store.find
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:142
▸ find(fn
): undefined
| ScheduledTask
Parameters
Name | Type |
---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
Returns
undefined
| ScheduledTask
Inherited from
Store.find
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:143
▸ find<This
, V2
>(fn
, thisArg
): undefined
| V2
Type parameters
Name | Type |
---|---|
This | This |
V2 | extends ScheduledTask |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => value is V2 |
thisArg | This |
Returns
undefined
| V2
Inherited from
Store.find
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:144
▸ find<This
>(fn
, thisArg
): undefined
| ScheduledTask
Type parameters
Name |
---|
This |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
thisArg | This |
Returns
undefined
| ScheduledTask
Inherited from
Store.find
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:145
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.
Type parameters
Name | Type |
---|---|
K2 | extends string |
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => key is K2 | The function to test with (should return boolean) |
Returns
undefined
| K2
Example
collection.findKey(user => user.username === 'Bob');
Inherited from
Store.findKey
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:158
▸ findKey(fn
): undefined
| string
Parameters
Name | Type |
---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
Returns
undefined
| string
Inherited from
Store.findKey
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:159
▸ findKey<This
, K2
>(fn
, thisArg
): undefined
| K2
Type parameters
Name | Type |
---|---|
This | This |
K2 | extends string |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => key is K2 |
thisArg | This |
Returns
undefined
| K2
Inherited from
Store.findKey
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:160
▸ findKey<This
>(fn
, thisArg
): undefined
| string
Type parameters
Name |
---|
This |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
thisArg | This |
Returns
undefined
| string
Inherited from
Store.findKey
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:161
first
▸ first(): undefined
| ScheduledTask
Obtains the first value(s) in this collection.
Returns
undefined
| ScheduledTask
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/@discordjs/collection/dist/index.d.ts:62
▸ first(amount
): ScheduledTask
[]
Parameters
Name | Type |
---|---|
amount | number |
Returns
Inherited from
Store.first
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:63
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/@discordjs/collection/dist/index.d.ts:71
▸ firstKey(amount
): string
[]
Parameters
Name | Type |
---|---|
amount | number |
Returns
string
[]
Inherited from
Store.firstKey
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:72
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().
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => Collection <string , T > | Function that produces a new Collection |
Returns
Collection
<string
, T
>
Example
collection.flatMap(guild => guild.members.cache);
Inherited from
Store.flatMap
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:217
▸ flatMap<T
, This
>(fn
, thisArg
): Collection
<string
, T
>
Type parameters
Name |
---|
T |
This |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => Collection <string , T > |
thisArg | This |
Returns
Collection
<string
, T
>
Inherited from
Store.flatMap
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:218
forEach
▸ forEach(callbackfn
, thisArg?
): void
Executes a provided function once per each key/value pair in the Map, in insertion order.
Parameters
Name | Type |
---|---|
callbackfn | (value : ScheduledTask , key : string , map : Map <string , ScheduledTask >) => void |
thisArg? | any |
Returns
void
Inherited from
Store.forEach
Defined in
node_modules/typescript/lib/lib.es2015.collection.d.ts:29
get
▸ get(key
): undefined
| ScheduledTask
Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
Parameters
Name | Type |
---|---|
key | string |
Returns
undefined
| ScheduledTask
Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
Inherited from
Store.get
Defined in
node_modules/typescript/lib/lib.es2015.collection.d.ts:34
has
▸ has(key
): boolean
Parameters
Name | Type |
---|---|
key | string |
Returns
boolean
boolean indicating whether an element with the specified key exists or not.
Inherited from
Store.has
Defined in
node_modules/typescript/lib/lib.es2015.collection.d.ts:38
hasAll
▸ hasAll(...keys
): boolean
Checks if all of the elements exist in the collection.
Parameters
Name | Type | Description |
---|---|---|
...keys | string [] | 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/@discordjs/collection/dist/index.d.ts:48
hasAny
▸ hasAny(...keys
): boolean
Checks if any of the elements exist in the collection.
Parameters
Name | Type | Description |
---|---|---|
...keys | string [] | 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/@discordjs/collection/dist/index.d.ts:55
insert
▸ insert(piece
): Promise
<ScheduledTask
>
Inserts a piece into the store.
Parameters
Name | Type | Description |
---|---|---|
piece | ScheduledTask | The piece to be inserted into the store. |
Returns
The inserted piece.
Inherited from
Store.insert
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:341
intersect
▸ intersect<T
>(other
): Collection
<string
, T
>
The intersect method returns a new structure containing items where the keys and values are present in both original structures.
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
other | ReadonlyCollection <string , T > | The other Collection to filter against |
Returns
Collection
<string
, T
>
Inherited from
Store.intersect
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:366
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
Name | Type | Description |
---|---|---|
index | number | The index of the key to obtain |
Returns
undefined
| string
Inherited from
Store.keyAt
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:106
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:129
last
▸ last(): undefined
| ScheduledTask
Obtains the last value(s) in this collection.
Returns
undefined
| ScheduledTask
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/@discordjs/collection/dist/index.d.ts:80
▸ last(amount
): ScheduledTask
[]
Parameters
Name | Type |
---|---|
amount | number |
Returns
Inherited from
Store.last
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:81
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/@discordjs/collection/dist/index.d.ts:89
▸ lastKey(amount
): string
[]
Parameters
Name | Type |
---|---|
amount | number |
Returns
string
[]
Inherited from
Store.lastKey
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:90
load
▸ load(root
, path
): Promise
<ScheduledTask
[]>
Loads one or more pieces from a path.
Parameters
Name | Type | Description |
---|---|---|
root | string | The root directory the file is from. |
path | string | The path of the file to load, relative to the root . |
Returns
All the loaded pieces.
Inherited from
Store.load
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:315
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:329
map
▸ map<T
>(fn
): T
[]
Maps each item to another value into an array. Identical in behavior to Array.map().
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => T | Function that produces an element of the new array, taking three arguments |
Returns
T
[]
Example
collection.map(user => user.tag);
Inherited from
Store.map
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:230
▸ map<This
, T
>(fn
, thisArg
): T
[]
Type parameters
Name |
---|
This |
T |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => T |
thisArg | This |
Returns
T
[]
Inherited from
Store.map
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:231
mapValues
▸ mapValues<T
>(fn
): Collection
<string
, T
>
Maps each item to another value into a collection. Identical in behavior to Array.map().
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => T | Function that produces an element of the new collection, taking three arguments |
Returns
Collection
<string
, T
>
Example
collection.mapValues(user => user.tag);
Inherited from
Store.mapValues
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:243
▸ mapValues<This
, T
>(fn
, thisArg
): Collection
<string
, T
>
Type parameters
Name |
---|
This |
T |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => T |
thisArg | This |
Returns
Collection
<string
, T
>
Inherited from
Store.mapValues
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:244
merge
▸ merge<T
, R
>(other
, whenInSelf
, whenInOther
, whenInBoth
): Collection
<string
, R
>
Merges two Collections together into a new Collection.
Type parameters
Name |
---|
T |
R |
Parameters
Name | Type | Description |
---|---|---|
other | ReadonlyCollection <string , T > | The other Collection to merge with |
whenInSelf | (value : ScheduledTask , key : string ) => Keep <R > | Function getting the result if the entry only exists in this Collection |
whenInOther | (valueOther : T , key : string ) => Keep <R > | Function getting the result if the entry only exists in the other Collection |
whenInBoth | (value : ScheduledTask , valueOther : T , key : string ) => Keep <R > | Function getting the result if the entry exists in both Collections |
Returns
Collection
<string
, R
>
Example
// Sums up the entries in two collections.
coll.merge(
other,
x => ({ keep: true, value: x }),
y => ({ keep: true, value: y }),
(x, y) => ({ keep: true, value: x + y }),
);
Example
// Intersects two collections in a left-biased manner.
coll.merge(
other,
x => ({ keep: false }),
y => ({ keep: false }),
(x, _) => ({ keep: true, value: x }),
);
Inherited from
Store.merge
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:407
partition
▸ partition<K2
>(fn
): [Collection
<K2
, ScheduledTask
>, Collection
<Exclude
<string
, K2
>, ScheduledTask
>]
Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.
Type parameters
Name | Type |
---|---|
K2 | extends string |
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => key is K2 | Function used to test (should return a boolean) |
Returns
[Collection
<K2
, ScheduledTask
>, Collection
<Exclude
<string
, K2
>, ScheduledTask
>]
Example
const [big, small] = collection.partition(guild => guild.memberCount > 250);
Inherited from
Store.partition
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:200
▸ partition<V2
>(fn
): [Collection
<string
, V2
>, Collection
<string
, Exclude
<ScheduledTask
, V2
>>]
Type parameters
Name | Type |
---|---|
V2 | extends ScheduledTask |
Parameters
Name | Type |
---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => value is V2 |
Returns
[Collection
<string
, V2
>, Collection
<string
, Exclude
<ScheduledTask
, V2
>>]
Inherited from
Store.partition
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:201
▸ partition(fn
): [Collection
<string
, ScheduledTask
>, Collection
<string
, ScheduledTask
>]
Parameters
Name | Type |
---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
Returns
[Collection
<string
, ScheduledTask
>, Collection
<string
, ScheduledTask
>]
Inherited from
Store.partition
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:202
▸ partition<This
, K2
>(fn
, thisArg
): [Collection
<K2
, ScheduledTask
>, Collection
<Exclude
<string
, K2
>, ScheduledTask
>]
Type parameters
Name | Type |
---|---|
This | This |
K2 | extends string |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => key is K2 |
thisArg | This |
Returns
[Collection
<K2
, ScheduledTask
>, Collection
<Exclude
<string
, K2
>, ScheduledTask
>]
Inherited from
Store.partition
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:203
▸ partition<This
, V2
>(fn
, thisArg
): [Collection
<string
, V2
>, Collection
<string
, Exclude
<ScheduledTask
, V2
>>]
Type parameters
Name | Type |
---|---|
This | This |
V2 | extends ScheduledTask |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => value is V2 |
thisArg | This |
Returns
[Collection
<string
, V2
>, Collection
<string
, Exclude
<ScheduledTask
, V2
>>]
Inherited from
Store.partition
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:204
▸ partition<This
>(fn
, thisArg
): [Collection
<string
, ScheduledTask
>, Collection
<string
, ScheduledTask
>]
Type parameters
Name |
---|
This |
Parameters
Name | Type |
---|---|
fn | (this : This , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
thisArg | This |
Returns
[Collection
<string
, ScheduledTask
>, Collection
<string
, ScheduledTask
>]
Inherited from
Store.partition
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:205
random
▸ random(): undefined
| ScheduledTask
Obtains unique random value(s) from this collection.
Returns
undefined
| ScheduledTask
A single value if no amount is provided or an array of values
Inherited from
Store.random
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:113
▸ random(amount
): ScheduledTask
[]
Parameters
Name | Type |
---|---|
amount | number |
Returns
Inherited from
Store.random
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:114
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/@discordjs/collection/dist/index.d.ts:121
▸ randomKey(amount
): string
[]
Parameters
Name | Type |
---|---|
amount | number |
Returns
string
[]
Inherited from
Store.randomKey
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:122
reduce
▸ reduce<T
>(fn
, initialValue?
): T
Applies a function to produce a single value. Identical in behavior to Array.reduce().
Type parameters
Name | Type |
---|---|
T | ScheduledTask |
Parameters
Name | Type | Description |
---|---|---|
fn | (accumulator : T , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => T | Function used to reduce, taking four arguments; accumulator , currentValue , currentKey , and collection |
initialValue? | T | Starting value for the accumulator |
Returns
T
Example
collection.reduce((acc, guild) => acc + guild.memberCount, 0);
Inherited from
Store.reduce
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:287
registerPath
▸ registerPath(path
): ScheduledTaskStore
Registers a directory into the store.
Parameters
Name | Type | Description |
---|---|---|
path | Path | The path to be added. |
Returns
Example
store
.registerPath(resolve('commands'))
.registerPath(resolve('third-party', 'commands'));
Inherited from
Store.registerPath
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:308
resolve
▸ resolve(name
): ScheduledTask
Resolves a piece by its name or its instance.
Parameters
Name | Type | Description |
---|---|---|
name | string | ScheduledTask | The name of the piece or the instance itself. |
Returns
The resolved piece.
Inherited from
Store.resolve
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:335
reverse
▸ reverse(): ScheduledTaskStore
Identical to Array.reverse() but returns a Collection instead of an Array.
Returns
Inherited from
Store.reverse
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:127
set
▸ set(key
, value
): ScheduledTaskStore
Parameters
Name | Type |
---|---|
key | string |
value | ScheduledTask |
Returns
Overrides
Store.set
Defined in
projects/plugins/packages/scheduled-tasks/src/lib/structures/ScheduledTaskStore.ts:11
some
▸ some(fn
): boolean
Checks if there exists an item that passes a test. Identical in behavior to Array.some().
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown | Function used to test (should return a boolean) |
Returns
boolean
Example
collection.some(user => user.discriminator === '0000');
Inherited from
Store.some
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:256
▸ some<T
>(fn
, thisArg
): boolean
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
fn | (this : T , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
thisArg | T |
Returns
boolean
Inherited from
Store.some
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:257
sort
▸ sort(compareFunction?
): ScheduledTaskStore
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.
Parameters
Name | Type | Description |
---|---|---|
compareFunction? | Comparator <string , ScheduledTask > | 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
Example
collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
Inherited from
Store.sort
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:360
sorted
▸ sorted(compareFunction?
): Collection
<string
, ScheduledTask
>
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.
Parameters
Name | Type | Description |
---|---|---|
compareFunction? | Comparator <string , ScheduledTask > | 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
, ScheduledTask
>
Example
collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
Inherited from
Store.sorted
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:421
subtract
▸ subtract<T
>(other
): Collection
<string
, ScheduledTask
>
The subtract method returns a new structure containing items where the keys and values of the original structure are not present in the other.
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
other | ReadonlyCollection <string , T > | The other Collection to filter against |
Returns
Collection
<string
, ScheduledTask
>
Inherited from
Store.subtract
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:372
sweep
▸ sweep(fn
): number
Removes items that satisfy the provided filter function.
Parameters
Name | Type | Description |
---|---|---|
fn | (value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown | Function used to test (should return a boolean) |
Returns
number
The number of removed entries
Inherited from
Store.sweep
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:169
▸ sweep<T
>(fn
, thisArg
): number
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
fn | (this : T , value : ScheduledTask , key : string , collection : ScheduledTaskStore ) => unknown |
thisArg | T |
Returns
number
Inherited from
Store.sweep
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:170
tap
▸ tap(fn
): ScheduledTaskStore
Runs a function on the collection and returns the collection.
Parameters
Name | Type | Description |
---|---|---|
fn | (collection : ScheduledTaskStore ) => void | Function to execute |
Returns
Example
collection
.tap(coll => console.log(coll.size))
.filter(user => user.bot)
.tap(coll => console.log(coll.size))
Inherited from
Store.tap
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:318
▸ tap<T
>(fn
, thisArg
): ScheduledTaskStore
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
fn | (this : T , collection : ScheduledTaskStore ) => void |
thisArg | T |
Returns
Inherited from
Store.tap
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:319
toJSON
▸ toJSON(): ScheduledTask
[]
Returns
Inherited from
Store.toJSON
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:422
unload
▸ unload(name
): Promise
<ScheduledTask
>
Unloads a piece given its instance or its name.
Parameters
Name | Type | Description |
---|---|---|
name | string | ScheduledTask | The name of the file to load. |
Returns
Returns the piece that was unloaded.
Inherited from
Store.unload
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:321
unloadAll
▸ unloadAll(): Promise
<ScheduledTask
[]>
Unloads all pieces from the store.
Returns
Inherited from
Store.unloadAll
Defined in
node_modules/@sapphire/pieces/dist/index.d.ts:325
values
▸ values(): IterableIterator
<ScheduledTask
>
Returns an iterable of values in the map
Returns
IterableIterator
<ScheduledTask
>
Inherited from
Store.values
Defined in
node_modules/typescript/lib/lib.es2015.iterable.d.ts:134
combineEntries
▸ Static
combineEntries<K
, V
>(entries
, combine
): Collection
<K
, V
>
Creates a Collection from a list of entries.
Type parameters
Name |
---|
K |
V |
Parameters
Name | Type | Description |
---|---|---|
entries | Iterable <[K , V ]> | The list of entries |
combine | (firstValue : V , secondValue : V , key : K ) => V | Function to combine an existing entry with a new one |
Returns
Collection
<K
, V
>
Example
Collection.combineEntries([["a", 1], ["b", 2], ["a", 2]], (x, y) => x + y);
// returns Collection { "a" => 3, "b" => 2 }
Inherited from
Store.combineEntries
Defined in
node_modules/@discordjs/collection/dist/index.d.ts:435