Files
discordeno/src/helpers/channels/editChannelOverwrite.ts
2021-12-05 16:50:03 +00:00

22 lines
712 B
TypeScript

import type { Overwrite } from "../../types/channels/overwrite.ts";
import type { Bot } from "../../bot.ts";
/** Edit the channel permission overwrites for a user or role in this channel. Requires `MANAGE_ROLES` permission. */
export async function editChannelOverwrite(
bot: Bot,
channelId: bigint,
overwriteId: bigint,
options: Omit<Overwrite, "id">
): Promise<undefined> {
await bot.rest.runMethod<undefined>(
bot.rest,
"put",
bot.constants.endpoints.CHANNEL_OVERWRITE(channelId, overwriteId),
{
allow: options.allow ? bot.utils.calculateBits(options.allow) : "0",
deny: options.deny ? bot.utils.calculateBits(options.deny) : "0",
type: options.type,
}
);
}