mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
buttons buttons and more buttons
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user