fir more things

This commit is contained in:
ITOH
2021-04-07 10:27:44 +02:00
parent 941ebd3beb
commit 313e7d2d35
16 changed files with 74 additions and 38 deletions
+5 -3
View File
@@ -1,7 +1,9 @@
import { rest } from "../../rest/rest.ts";
import { Ban, DiscordBan } from "../../types/guilds/ban.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts";
/** Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission. */
export async function getBans(guildId: string) {
@@ -10,9 +12,9 @@ export async function getBans(guildId: string) {
const results = (await rest.runMethod(
"get",
endpoints.GUILD_BANS(guildId),
)) as BannedUser[];
)) as DiscordBan[];
return new Collection<string, BannedUser>(
results.map((res) => [res.user.id, res]),
return new Collection<string, Ban>(
results.map((res) => [res.user.id, snakeKeysToCamelCase(res) as Ban]),
);
}