Add Guild.fetchChannel method

This commit is contained in:
Nicolás Serna 2022-07-30 19:46:37 -03:00
parent 1b814cebdf
commit 2a0186d16c

View File

@ -16,6 +16,7 @@ import {
DiscordOverwrite, DiscordOverwrite,
DiscordRole, DiscordRole,
DiscordVoiceRegion, DiscordVoiceRegion,
DiscordChannel,
ExplicitContentFilterLevels, ExplicitContentFilterLevels,
GuildNsfwLevel, GuildNsfwLevel,
MakeRequired, MakeRequired,
@ -52,8 +53,9 @@ import {
GUILD_VANITY, GUILD_VANITY,
GUILD_WIDGET, GUILD_WIDGET,
USER_GUILDS, USER_GUILDS,
CHANNEL,
} from '@biscuitland/api-types'; } from '@biscuitland/api-types';
import { GuildChannel, ReturnThreadsArchive, ThreadChannel } from './channels'; import { ChannelFactory, GuildChannel, ReturnThreadsArchive, ThreadChannel, Channel } from './channels';
import { Member, ThreadMember } from './members'; import { Member, ThreadMember } from './members';
import { Role } from './role'; import { Role } from './role';
import { GuildEmoji } from './emojis'; import { GuildEmoji } from './emojis';
@ -1210,4 +1212,10 @@ export class Guild extends BaseGuild implements Model {
return new GuildPreview(this.session, preview); return new GuildPreview(this.session, preview);
} }
async fetchChannel(channelID: string): Promise<Channel> {
const channel = await this.session.rest.get<DiscordChannel>(CHANNEL(channelID));
return ChannelFactory.from(this.session, channel);
}
} }