mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
Remove editChannelOverwrite()
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user