feat(Guild): add fetchBan and withReasons to fetchBans (#3170)

* add Guild#fetchBan() & backport BanInfo

* and the typings

* requested changes

* typings overloads

Co-Authored-By: izexi <43889168+izexi@users.noreply.github.com>

* nullable reason typings

Co-Authored-By: izexi <43889168+izexi@users.noreply.github.com>
This commit is contained in:
izexi
2019-04-01 08:07:52 +01:00
committed by SpaceEEC
parent 745e18b823
commit 5cd6d8d380
3 changed files with 42 additions and 3 deletions

10
typings/index.d.ts vendored
View File

@@ -533,7 +533,10 @@ declare module 'discord.js' {
public edit(data: GuildEditData, reason?: string): Promise<Guild>;
public equals(guild: Guild): boolean;
public fetchAuditLogs(options?: GuildAuditLogsFetchOptions): Promise<GuildAuditLogs>;
public fetchBans(): Promise<Collection<Snowflake, User>>;
public fetchBan(user: UserResolvable): Promise<BanInfo>;
public fetchBans(withReasons?: false): Promise<Collection<Snowflake, User>>;
public fetchBans(withReasons: true): Promise<Collection<Snowflake, BanInfo>>;
public fetchBans(withReasons: boolean): Promise<Collection<Snowflake, BanInfo | User>>;
public fetchEmbed(): Promise<GuildEmbedData>;
public fetchInvites(): Promise<Collection<Snowflake, Invite>>;
public fetchMember(user: UserResolvable, cache?: boolean): Promise<GuildMember>;
@@ -1600,6 +1603,11 @@ declare module 'discord.js' {
type AwaitReactionsOptions = ReactionCollectorOptions & { errors?: string[] };
type BanInfo = {
user: User;
reason: string | null;
};
type BanOptions = {
days?: number;
reason?: string;