feat(RoleStore, ChannelStore): fetch() method (#3071)

* feat({Role,Channel}Store): fetch method

* docs: Add usage examples to the new methods

* misc: Add note of why we are fetching all roles even for a single one
This commit is contained in:
Kyra
2019-02-09 16:07:31 +01:00
committed by Amish Shah
parent ae7269088b
commit c432591113
3 changed files with 49 additions and 0 deletions

3
typings/index.d.ts vendored
View File

@@ -1320,6 +1320,7 @@ declare module 'discord.js' {
export class ChannelStore extends DataStore<Snowflake, Channel, typeof Channel, ChannelResolvable> {
constructor(client: Client, iterable: Iterable<any>, options?: { lru: boolean });
constructor(client: Client, options?: { lru: boolean });
public fetch(id: Snowflake, cache?: boolean): Promise<Channel>;
}
export class DataStore<K, V, VConstructor = Constructable<V>, R = any> extends Collection<K, V> {
@@ -1410,6 +1411,8 @@ declare module 'discord.js' {
public readonly highest: Role;
public create(options?: { data?: RoleData, reason?: string }): Promise<Role>;
public fetch(id?: Snowflake, cache?: boolean): Promise<this>;
public fetch(id: Snowflake, cache?: boolean): Promise<Role | null>;
}
export class UserStore extends DataStore<Snowflake, User, typeof User, UserResolvable> {