diff --git a/src/helpers/invites/create_invite.ts b/src/helpers/invites/create_invite.ts index 7711b05d2..c3354a3fe 100644 --- a/src/helpers/invites/create_invite.ts +++ b/src/helpers/invites/create_invite.ts @@ -1,12 +1,12 @@ import { rest } from "../../rest/rest.ts"; import type { CreateChannelInvite } from "../../types/invites/create_channel_invite.ts"; -import type { Invite } from "../../types/invites/invite.ts"; +import type { InviteMetadata } from "../../types/invites/invite_metadata.ts"; import { Errors } from "../../types/discordeno/errors.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: bigint, options: CreateChannelInvite) { +export async function createInvite(channelId: bigint, options: CreateChannelInvite = {}) { await requireBotChannelPermissions(channelId, ["CREATE_INSTANT_INVITE"]); if (options.maxAge && (options.maxAge < 0 || options.maxAge > 604800)) { @@ -16,5 +16,5 @@ export async function createInvite(channelId: bigint, options: CreateChannelInvi throw new Error(Errors.INVITE_MAX_USES_INVALID); } - return await rest.runMethod("post", endpoints.CHANNEL_INVITES(channelId), options); + return await rest.runMethod("post", endpoints.CHANNEL_INVITES(channelId), options); } diff --git a/src/helpers/invites/delete_invite.ts b/src/helpers/invites/delete_invite.ts index b9b18c8d7..fe033ddf6 100644 --- a/src/helpers/invites/delete_invite.ts +++ b/src/helpers/invites/delete_invite.ts @@ -1,6 +1,6 @@ import { cacheHandlers } from "../../cache.ts"; import { rest } from "../../rest/rest.ts"; -import type { Invite } from "../../types/invites/invite.ts"; +import type { InviteMetadata } from "../../types/invites/invite_metadata.ts"; import { endpoints } from "../../util/constants.ts"; import { botHasChannelPermissions, requireBotGuildPermissions } from "../../util/permissions.ts"; @@ -15,5 +15,5 @@ export async function deleteInvite(channelId: bigint, inviteCode: string) { } } - return await rest.runMethod("delete", endpoints.INVITE(inviteCode)); + return await rest.runMethod("delete", endpoints.INVITE(inviteCode)); } diff --git a/src/helpers/invites/get_channel_invites.ts b/src/helpers/invites/get_channel_invites.ts index db8b3834c..3877b6c7f 100644 --- a/src/helpers/invites/get_channel_invites.ts +++ b/src/helpers/invites/get_channel_invites.ts @@ -1,5 +1,5 @@ import { rest } from "../../rest/rest.ts"; -import type { Invite } from "../../types/invites/invite.ts"; +import type { InviteMetadata } from "../../types/invites/invite_metadata.ts"; import { Collection } from "../../util/collection.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotChannelPermissions } from "../../util/permissions.ts"; @@ -8,7 +8,7 @@ import { requireBotChannelPermissions } from "../../util/permissions.ts"; export async function getChannelInvites(channelId: bigint) { await requireBotChannelPermissions(channelId, ["MANAGE_CHANNELS"]); - const result = await rest.runMethod("get", endpoints.CHANNEL_INVITES(channelId)); + const result = await rest.runMethod("get", endpoints.CHANNEL_INVITES(channelId)); return new Collection(result.map((invite) => [invite.code, invite])); } diff --git a/src/helpers/invites/get_invite.ts b/src/helpers/invites/get_invite.ts index d6a58e4ec..dbe9c7062 100644 --- a/src/helpers/invites/get_invite.ts +++ b/src/helpers/invites/get_invite.ts @@ -1,10 +1,10 @@ import { rest } from "../../rest/rest.ts"; import { GetInvite } from "../../types/invites/get_invite.ts"; -import type { Invite } from "../../types/invites/invite.ts"; +import type { InviteMetadata } from "../../types/invites/invite_metadata.ts"; import { endpoints } from "../../util/constants.ts"; import { snakelize } from "../../util/utils.ts"; /** Returns an invite for the given code or throws an error if the invite doesn't exists. */ export async function getInvite(inviteCode: string, options?: GetInvite) { - return await rest.runMethod("get", endpoints.INVITE(inviteCode), snakelize(options ?? {})); + return await rest.runMethod("get", endpoints.INVITE(inviteCode), snakelize(options ?? {})); } diff --git a/src/helpers/invites/get_invites.ts b/src/helpers/invites/get_invites.ts index a74e2bbec..59098bfbf 100644 --- a/src/helpers/invites/get_invites.ts +++ b/src/helpers/invites/get_invites.ts @@ -1,5 +1,5 @@ import { rest } from "../../rest/rest.ts"; -import type { Invite } from "../../types/invites/invite.ts"; +import type { InviteMetadata } from "../../types/invites/invite_metadata.ts"; import { Collection } from "../../util/collection.ts"; import { endpoints } from "../../util/constants.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts"; @@ -8,7 +8,7 @@ import { requireBotGuildPermissions } from "../../util/permissions.ts"; export async function getInvites(guildId: bigint) { await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); - const result = await rest.runMethod("get", endpoints.GUILD_INVITES(guildId)); + const result = await rest.runMethod("get", endpoints.GUILD_INVITES(guildId)); return new Collection(result.map((invite) => [invite.code, invite])); }