From 2634a5d37c371f24fb9ba68a702a7ea2847d03ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Serna?= Date: Sat, 30 Jul 2022 19:56:24 -0300 Subject: [PATCH] Add Guild.fetchChannels method --- packages/core/src/structures/guilds.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/src/structures/guilds.ts b/packages/core/src/structures/guilds.ts index ef7f202..1a87a56 100644 --- a/packages/core/src/structures/guilds.ts +++ b/packages/core/src/structures/guilds.ts @@ -56,6 +56,7 @@ import { GUILD_WIDGET, USER_GUILDS, CHANNEL, + GUILD_CHANNELS, } from '@biscuitland/api-types'; import { ChannelFactory, GuildChannel, ReturnThreadsArchive, ThreadChannel, Channel } from './channels'; import { Member, ThreadMember } from './members'; @@ -1220,7 +1221,13 @@ export class Guild extends BaseGuild implements Model { return ChannelFactory.from(this.session, channel); } - + + async fetchChannels(): Promise { + const channels = await this.session.rest.get(GUILD_CHANNELS(this.id)); + + return channels.map(channel => ChannelFactory.from(this.session, channel)); + } + /** fetches a member */ async fetchMember(memberId: Snowflake): Promise { const member = await this.session.rest.get(