mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-05 06:26:08 +00:00
fix: Channels.fetch()
This commit is contained in:
parent
39f38f9e23
commit
8f370d4c59
@ -9,7 +9,7 @@ import type { PermissionsOverwrites } from '../utils/util';
|
||||
import { urlToBase64 } from '../utils/url-to-base-64';
|
||||
|
||||
/** Classes and routes */
|
||||
import type {
|
||||
import {
|
||||
DiscordChannel,
|
||||
DiscordInvite,
|
||||
DiscordInviteMetadata,
|
||||
@ -22,7 +22,8 @@ import type {
|
||||
VideoQualityModes,
|
||||
GetReactions,
|
||||
GetMessagesOptions,
|
||||
ListArchivedThreads } from '@biscuitland/api-types';
|
||||
ListArchivedThreads,
|
||||
USER_DM} from '@biscuitland/api-types';
|
||||
import {
|
||||
CHANNEL,
|
||||
CHANNEL_PINS,
|
||||
@ -102,8 +103,8 @@ export abstract class BaseChannel implements Model {
|
||||
return this.type === ChannelTypes.GuildStageVoice;
|
||||
}
|
||||
|
||||
async fetch(): Promise<Channel> {
|
||||
const channel = await this.session.rest.get<DiscordChannel>(CHANNEL(this.id));
|
||||
async fetch(channelId?: Snowflake): Promise<Channel> {
|
||||
const channel = await this.session.rest.get<DiscordChannel>(CHANNEL(channelId ?? this.id));
|
||||
|
||||
return ChannelFactory.from(this.session, channel);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ import {
|
||||
CHANNEL,
|
||||
GUILD_CHANNELS,
|
||||
} from '@biscuitland/api-types';
|
||||
import { ChannelFactory, GuildChannel, ReturnThreadsArchive, ThreadChannel, Channel } from './channels';
|
||||
import { ChannelFactory, GuildChannel, ReturnThreadsArchive, ThreadChannel, ChannelInGuild } from './channels';
|
||||
import { Member, ThreadMember } from './members';
|
||||
import { Role } from './role';
|
||||
import { GuildEmoji } from './emojis';
|
||||
@ -1216,16 +1216,16 @@ export class Guild extends BaseGuild implements Model {
|
||||
return new GuildPreview(this.session, preview);
|
||||
}
|
||||
|
||||
async fetchChannel(channelID: string): Promise<Channel> {
|
||||
const channel = await this.session.rest.get<DiscordChannel>(CHANNEL(channelID));
|
||||
async fetchChannel(channelId: string): Promise<ChannelInGuild> {
|
||||
const channel = await this.session.rest.get<DiscordChannel>(CHANNEL(channelId));
|
||||
|
||||
return ChannelFactory.from(this.session, channel);
|
||||
return ChannelFactory.fromGuildChannel(this.session, channel);
|
||||
}
|
||||
|
||||
async fetchChannels(): Promise<Channel[]> {
|
||||
async fetchChannels(): Promise<ChannelInGuild[]> {
|
||||
const channels = await this.session.rest.get<DiscordChannel[]>(GUILD_CHANNELS(this.id));
|
||||
|
||||
return channels.map(channel => ChannelFactory.from(this.session, channel));
|
||||
return channels.map(channel => ChannelFactory.fromGuildChannel(this.session, channel));
|
||||
}
|
||||
|
||||
/** fetches a member */
|
||||
|
Loading…
x
Reference in New Issue
Block a user