Files
discordeno/src/helpers/guilds/get_voice_regions.ts
T
2021-10-21 19:38:09 +02:00

11 lines
601 B
TypeScript

import type { VoiceRegion } from "../../types/voice/voice_region.ts";
import { Collection } from "../../util/collection.ts";
import type { Bot } from "../../bot.ts";
/** Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled. */
export async function getVoiceRegions(boot: Bot, guildId: bigint) {
const result = await bot.rest.runMethod<VoiceRegion[]>(bot.rest,"get", bot.constants.endpoints.GUILD_REGIONS(guildId));
return new Collection<string, VoiceRegion>(result.map((region) => [region.id, region]));
}