buttons buttons and more buttons

This commit is contained in:
Skillz
2021-05-01 08:16:28 -04:00
parent b0ce5c2e56
commit 6de8e1d428
28 changed files with 235 additions and 63 deletions
+8 -2
View File
@@ -1,6 +1,7 @@
import { rest } from "../../rest/rest.ts";
import { CreateChannelInvite } from "../../types/invites/create_channel_invite.ts";
import { Invite } from "../../types/mod.ts";
import { Invite } from "../../types/invites/invite.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
@@ -11,7 +12,12 @@ export async function createInvite(
) {
await requireBotChannelPermissions(channelId, ["CREATE_INSTANT_INVITE"]);
// TODO: add proper options validation
if (options.maxAge && (options.maxAge < 0 || options.maxAge > 604800)) {
throw new Error(Errors.INVITE_MAX_AGE_INVALID);
}
if (options.maxUses && (options.maxUses < 0 || options.maxUses > 100)) {
throw new Error(Errors.INVITE_MAX_USES_INVALID);
}
return await rest.runMethod<Invite>(
"post",