feat: bypass cache check with forceFetch param (#4592)

This commit is contained in:
Carter
2020-08-12 13:23:04 -06:00
committed by GitHub
parent 0225851e40
commit 290938bf80
11 changed files with 84 additions and 45 deletions

32
typings/index.d.ts vendored
View File

@@ -159,7 +159,7 @@ declare module 'discord.js' {
public id: Snowflake;
public type: keyof typeof ChannelType;
public delete(reason?: string): Promise<Channel>;
public fetch(): Promise<Channel>;
public fetch(force?: boolean): Promise<Channel>;
public toString(): string;
}
@@ -581,7 +581,7 @@ declare module 'discord.js' {
public recipient: User;
public readonly partial: false;
public type: 'dm';
public fetch(): Promise<this>;
public fetch(force?: boolean): Promise<this>;
}
export class Emoji extends Base {
@@ -836,8 +836,8 @@ declare module 'discord.js' {
public user: User;
public readonly voice: VoiceState;
public ban(options?: BanOptions): Promise<GuildMember>;
public fetch(): Promise<GuildMember>;
public createDM(): Promise<DMChannel>;
public fetch(force?: boolean): Promise<GuildMember>;
public createDM(force?: boolean): Promise<DMChannel>;
public deleteDM(): Promise<DMChannel>;
public edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>;
public hasPermission(
@@ -985,7 +985,7 @@ declare module 'discord.js' {
public edit(options: MessageEditOptions | MessageEmbed | APIMessage): Promise<Message>;
public equals(message: Message, rawData: object): boolean;
public fetchWebhook(): Promise<Webhook>;
public fetch(): Promise<Message>;
public fetch(force?: boolean): Promise<Message>;
public pin(options?: { reason?: string }): Promise<Message>;
public react(emoji: EmojiIdentifierResolvable): Promise<MessageReaction>;
public reply(
@@ -1520,8 +1520,8 @@ declare module 'discord.js' {
public deleteDM(): Promise<DMChannel>;
public displayAvatarURL(options?: ImageURLOptions & { dynamic?: boolean }): string;
public equals(user: User): boolean;
public fetch(): Promise<User>;
public fetchFlags(): Promise<UserFlags>;
public fetch(force?: boolean): Promise<User>;
public fetchFlags(force?: boolean): Promise<UserFlags>;
public toString(): string;
public typingDurationIn(channel: ChannelResolvable): number;
public typingIn(channel: ChannelResolvable): boolean;
@@ -1854,7 +1854,7 @@ declare module 'discord.js' {
export class ChannelManager extends BaseManager<Snowflake, Channel, ChannelResolvable> {
constructor(client: Client, iterable: Iterable<any>);
public fetch(id: Snowflake, cache?: boolean): Promise<Channel>;
public fetch(id: Snowflake, cache?: boolean, force?: boolean): Promise<Channel>;
}
export abstract class BaseManager<K, Holds, R> {
@@ -1946,8 +1946,12 @@ declare module 'discord.js' {
constructor(channel: TextChannel | DMChannel, iterable?: Iterable<any>);
public channel: TextBasedChannelFields;
public cache: Collection<Snowflake, Message>;
public fetch(message: Snowflake, cache?: boolean): Promise<Message>;
public fetch(options?: ChannelLogsQueryOptions, cache?: boolean): Promise<Collection<Snowflake, Message>>;
public fetch(message: Snowflake, cache?: boolean, force?: boolean): Promise<Message>;
public fetch(
options?: ChannelLogsQueryOptions,
cache?: boolean,
force?: boolean,
): Promise<Collection<Snowflake, Message>>;
public fetchPinned(cache?: boolean): Promise<Collection<Snowflake, Message>>;
public delete(message: MessageResolvable, reason?: string): Promise<void>;
}
@@ -1986,13 +1990,13 @@ declare module 'discord.js' {
public guild: Guild;
public create(options?: { data?: RoleData; reason?: string }): Promise<Role>;
public fetch(id: Snowflake, cache?: boolean): Promise<Role | null>;
public fetch(id?: Snowflake, cache?: boolean): Promise<this>;
public fetch(id: Snowflake, cache?: boolean, force?: boolean): Promise<Role | null>;
public fetch(id?: Snowflake, cache?: boolean, force?: boolean): Promise<this>;
}
export class UserManager extends BaseManager<Snowflake, User, UserResolvable> {
constructor(client: Client, iterable?: Iterable<any>);
public fetch(id: Snowflake, cache?: boolean): Promise<User>;
public fetch(id: Snowflake, cache?: boolean, force?: boolean): Promise<User>;
}
export class VoiceStateManager extends BaseManager<Snowflake, VoiceState, typeof VoiceState> {
@@ -2424,6 +2428,7 @@ declare module 'discord.js' {
interface FetchMemberOptions {
user: UserResolvable;
cache?: boolean;
force?: boolean;
}
interface FetchMembersOptions {
@@ -2433,6 +2438,7 @@ declare module 'discord.js' {
withPresences?: boolean;
time?: number;
nonce?: string;
force?: boolean;
}
interface FileOptions {