Files
discordeno/helpers/channels/deleteChannelPermissionOverride.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

30 lines
864 B
TypeScript

import type { Bot } from "../../bot.ts";
/**
* Deletes a permission override for a user or role in a channel.
*
* @param bot - The bot instance to use to make the request.
* @param channelId - The ID of the channel to delete the permission override of.
* @param overwriteId - The ID of the permission override to delete.
*
* @remarks
* Requires the `MANAGE_ROLES` permission.
*
* Fires a _Channel Update_ gateway event.
*
* @see {@link https://discord.com/developers/docs/resources/channel#delete-channel-permission}
*/
export async function deleteChannelPermissionOverride(
bot: Bot,
channelId: bigint,
overwriteId: bigint,
reason?: string,
): Promise<void> {
return await bot.rest.runMethod<void>(
bot.rest,
"DELETE",
bot.constants.routes.CHANNEL_OVERWRITE(channelId, overwriteId),
reason ? { reason } : undefined,
);
}