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,11 +1,13 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { DiscordInvite, Invite } from "../../types/invites/invite.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import {
botHasChannelPermissions,
requireBotGuildPermissions,
} from "../../util/permissions.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts";
/** Deletes an invite for the given code. Requires `MANAGE_CHANNELS` or `MANAGE_GUILD` permission */
export async function deleteInvite(channelId: string, inviteCode: string) {
@@ -21,7 +23,10 @@ export async function deleteInvite(channelId: string, inviteCode: string) {
await requireBotGuildPermissions(channel!.guildId, ["MANAGE_GUILD"]);
}
const result = await rest.runMethod("delete", endpoints.INVITE(inviteCode));
const result: DiscordInvite = await rest.runMethod(
"delete",
endpoints.INVITE(inviteCode),
);
return result as InvitePayload;
return snakeKeysToCamelCase<Invite>(result);
}