Guilds helpers

This commit is contained in:
TriForMine
2021-10-21 19:38:09 +02:00
parent baf8583976
commit 20616e8a36
29 changed files with 156 additions and 167 deletions
+3 -4
View File
@@ -1,11 +1,10 @@
import { rest } from "../../rest/rest.ts";
import type { VoiceRegion } from "../../types/voice/voice_region.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.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(guildId: bigint) {
const result = await rest.runMethod<VoiceRegion[]>("get", endpoints.GUILD_REGIONS(guildId));
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]));
}