mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 21:46:08 +00:00
Add Guild.fetchVoiceRegions method
This commit is contained in:
parent
e81b80d5cf
commit
b108b74030
@ -448,3 +448,8 @@ export function GUILD_WIDGET(guildId: Snowflake, options: GetWidget = { get: 'se
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
/** @link https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
|
||||
export function GUILD_VOICE_REGIONS(guildId: string): string {
|
||||
return `/guilds/${guildId}/regions`;
|
||||
}
|
@ -10,6 +10,7 @@ import type {
|
||||
DiscordMemberWithUser,
|
||||
DiscordOverwrite,
|
||||
DiscordRole,
|
||||
DiscordVoiceRegion,
|
||||
ExplicitContentFilterLevels,
|
||||
GuildNsfwLevel,
|
||||
MakeRequired,
|
||||
@ -994,6 +995,19 @@ export class Guild extends BaseGuild implements Model {
|
||||
|
||||
return new Guild(this.session, guild);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchVoiceRegions gets the voice regions available for the guild.
|
||||
* @see {@link DiscordVoiceRegion}
|
||||
* @returns Promise that resolves to an array of voice regions.
|
||||
*/
|
||||
async fetchVoiceRegions(): Promise<DiscordVoiceRegion[]> {
|
||||
return await this.session.rest.runMethod<DiscordVoiceRegion[]>(
|
||||
this.session.rest,
|
||||
'GET',
|
||||
Routes.GUILD_VOICE_REGIONS(this.id),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Guild;
|
||||
|
2
packages/cache/guilds.ts
vendored
2
packages/cache/guilds.ts
vendored
@ -32,7 +32,7 @@ export function guildBootstrapper(cache: SessionCache, guild: DiscordGuild) {
|
||||
const channels = new Collection(
|
||||
cache.session,
|
||||
guild.channels?.map((data) => {
|
||||
const obj = Object.assign(ChannelFactory.from(cache.session, data), {
|
||||
const obj = data && Object.assign(ChannelFactory.from(cache.session, data), {
|
||||
messages: new Map(),
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user