Files
discordeno/helpers/guilds/invites/deleteInvite.ts
T
LTS20050703andSkillz4Killz 16f109ad43 chore: WithReason type cleanup (#2449)
* type WithReason<T> = T & { reason?: string }

* deno fmt (1.25.2)

* WithReason: jsdoc comments for reason

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>

* deno fmt

* types: WithReason type -> WithReason interface

* Fix: Some helpers missing support for reason

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2022-09-12 08:52:03 -05:00

24 lines
675 B
TypeScript

import type { Bot } from "../../../bot.ts";
/**
* Deletes an invite to a channel.
*
* @param bot - The bot instance to use to make the request.
* @param inviteCode - The invite code of the invite to delete.
*
* @remarks
* Requires the `MANAGE_CHANNELS` permission.
*
* Fires an _Invite Delete_ gateway event.
*
* @see {@link https://discord.com/developers/docs/resources/channel#delete-channel-invite}
*/
export async function deleteInvite(bot: Bot, inviteCode: string, reason?: string): Promise<void> {
return await bot.rest.runMethod<void>(
bot.rest,
"DELETE",
bot.constants.routes.INVITE(inviteCode),
reason ? { reason } : undefined,
);
}