Remove editChannelOverwrite()

This commit is contained in:
ITOH
2020-12-10 08:10:33 +01:00
parent 20c289308d
commit 77890fe9f0
-43
View File
@@ -13,13 +13,11 @@ import {
GetMessagesBefore,
MessageContent,
MessageCreateOptions,
Overwrite,
Permission,
Permissions,
RawOverwrite,
WebhookPayload,
} from "../types/types.ts";
import { cache } from "../utils/cache.ts";
import { endpoints } from "../utils/constants.ts";
import {
botHasChannelPermissions,
@@ -421,47 +419,6 @@ export async function editChannel(
);
}
export async function editChannelOverwrite(
channelID: string,
overwrite: Overwrite,
reason?: string,
) {
const hasManageChannelPerm = await botHasChannelPermissions(
channelID,
["MANAGE_CHANNELS"],
);
if (!hasManageChannelPerm) {
throw new Error(Errors.MISSING_MANAGE_CHANNELS);
}
let channel = cache.channels.get(channelID);
if (!channel) throw new Error(Errors.CHANNEL_NOT_FOUND);
const payload = {
permission_overwrites: [
...(channel?.permissionOverwrites || []).map((rawOverwrite) => ({
id: rawOverwrite.id,
type: rawOverwrite.type,
allow: rawOverwrite.allow,
deny: rawOverwrite.deny,
})),
{
...overwrite,
allow: calculateBits(overwrite.allow),
deny: calculateBits(overwrite.deny),
},
],
};
return RequestManager.patch(
endpoints.GUILD_CHANNEL(channelID),
{
...payload,
reason,
},
);
}
/** Follow a News Channel to send messages to a target channel. Requires the `MANAGE_WEBHOOKS` permission in the target channel. Returns the webhook id. */
export async function followChannel(
sourceChannelID: string,