mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
nothin'
This commit is contained in:
@@ -1,27 +1,16 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { InviteCreate } from "../../types/invites/invite_create.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { requireBotChannelPermissions } from "../../util/permissions.ts";
|
||||
|
||||
/** Creates a new invite for this channel. Requires CREATE_INSTANT_INVITE */
|
||||
export async function createInvite(
|
||||
channelId: string,
|
||||
options: CreateInviteOptions,
|
||||
options: InviteCreate,
|
||||
) {
|
||||
await requireBotChannelPermissions(channelId, ["CREATE_INSTANT_INVITE"]);
|
||||
|
||||
if (options.max_age && (options.max_age > 604800 || options.max_age < 0)) {
|
||||
console.log(
|
||||
`The max age for invite created in ${channelId} was not between 0-604800. Using default values instead.`,
|
||||
);
|
||||
options.max_age = undefined;
|
||||
}
|
||||
|
||||
if (options.max_uses && (options.max_uses > 100 || options.max_uses < 0)) {
|
||||
console.log(
|
||||
`The max uses for invite created in ${channelId} was not between 0-100. Using default values instead.`,
|
||||
);
|
||||
options.max_uses = undefined;
|
||||
}
|
||||
// TODO: add proper options validation
|
||||
|
||||
const result = await rest.runMethod(
|
||||
"post",
|
||||
|
||||
Reference in New Issue
Block a user