This commit is contained in:
ayntee
2021-04-12 23:01:39 +04:00
parent 64824272aa
commit 3153487b51
3 changed files with 17 additions and 18 deletions
+7 -2
View File
@@ -1,9 +1,14 @@
import { rest } from "../../rest/rest.ts";
import { DiscordInvite, Invite } from "../../types/invites/invite.ts";
import { endpoints } from "../../util/constants.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts";
/** Returns an invite for the given code. */
export async function getInvite(inviteCode: string) {
const result = await rest.runMethod("get", endpoints.INVITE(inviteCode));
const result: DiscordInvite = await rest.runMethod(
"get",
endpoints.INVITE(inviteCode),
);
return result as InvitePayload;
return snakeKeysToCamelCase<Invite>(result);
}