diff --git a/src/structures/invite.ts b/src/structures/invite.ts index 59d172d..f27f841 100644 --- a/src/structures/invite.ts +++ b/src/structures/invite.ts @@ -1,5 +1,6 @@ import { Client } from '../models/client.ts' import { ChannelPayload } from '../types/channel.ts' +import { INVITE } from '../types/endpoint.ts' import { GuildPayload } from '../types/guild.ts' import { InvitePayload } from '../types/invite.ts' import { UserPayload } from '../types/user.ts' @@ -31,6 +32,12 @@ export class Invite extends Base { this.approximatePresenceCount = data.approximate_presence_count } + /** Delete an invite. Requires the MANAGE_CHANNELS permission on the channel this invite belongs to, or MANAGE_GUILD to remove any invite across the guild. Returns an invite object on success. Fires a Invite Delete Gateway event. */ + async delete(): Promise { + const res = await this.client.rest.delete(INVITE(this.code)) + return new Invite(this.client, res) + } + readFromData(data: InvitePayload): void { this.code = data.code ?? this.code this.guild = data.guild ?? this.guild