From 9e6a8699ff203efeaa256831e9c4919357239f86 Mon Sep 17 00:00:00 2001 From: Yuzu Date: Thu, 30 Jun 2022 11:41:23 -0500 Subject: [PATCH] feat: GuildChannel.fetchInvites --- structures/GuildChannel.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/structures/GuildChannel.ts b/structures/GuildChannel.ts index 2d60291..99ea4ff 100644 --- a/structures/GuildChannel.ts +++ b/structures/GuildChannel.ts @@ -1,8 +1,9 @@ import type { Model } from "./Base.ts"; import type { Snowflake } from "../util/Snowflake.ts"; import type { Session } from "../session/Session.ts"; -import type { DiscordChannel } from "../vendor/external.ts"; +import type { DiscordChannel, DiscordInviteMetadata } from "../vendor/external.ts"; import Channel from "./Channel.ts"; +import Invite from "./Invite.ts"; import * as Routes from "../util/Routes.ts"; export abstract class GuildChannel extends Channel implements Model { @@ -19,6 +20,16 @@ export abstract class GuildChannel extends Channel implements Model { position?: number; parentId?: Snowflake; + async fetchInvites(): Promise { + const invites = await this.session.rest.runMethod( + this.session.rest, + "GET", + Routes.CHANNEL_INVITES(this.id), + ); + + return invites.map((invite) => new Invite(this.session, invite)); + } + async delete(reason?: string) { await this.session.rest.runMethod( this.session.rest,