mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-31 16:00:07 +00:00
fix(helpers): when creating/modifying a channel permission_overwrites can omit the allow and deny (#2053)
Clarify that permission_overwrites can omit allow and deny keys when creating/modifying channel/channel ovewrites
This commit is contained in:
@@ -22,11 +22,11 @@ export async function createChannel(bot: Bot, guildId: bigint, options?: CreateG
|
||||
position: options.position,
|
||||
parent_id: options.parentId?.toString(),
|
||||
nsfw: options.nsfw,
|
||||
permission_overwrites: options?.permissionOverwrites?.map((perm) => ({
|
||||
id: perm.id.toString(),
|
||||
type: perm.type,
|
||||
allow: perm.allow ? bot.utils.calculateBits(perm.allow) : "0",
|
||||
deny: perm.deny ? bot.utils.calculateBits(perm.deny) : "0",
|
||||
permission_overwrites: options?.permissionOverwrites?.map((overwrite) => ({
|
||||
id: overwrite.id.toString(),
|
||||
type: overwrite.type,
|
||||
allow: overwrite.allow ? bot.utils.calculateBits(overwrite.allow) : null,
|
||||
deny: overwrite.deny ? bot.utils.calculateBits(overwrite.deny) : null,
|
||||
})),
|
||||
type: options?.type || ChannelTypes.GuildText,
|
||||
reason,
|
||||
|
||||
@@ -46,13 +46,12 @@ export async function editChannel(bot: Bot, channelId: bigint, options: ModifyCh
|
||||
locked: options.locked,
|
||||
invitable: options.invitable,
|
||||
permission_overwrites: options.permissionOverwrites
|
||||
? options.permissionOverwrites?.map((overwrite) => {
|
||||
return {
|
||||
...overwrite,
|
||||
allow: overwrite.allow ? bot.utils.calculateBits(overwrite.allow) : "0",
|
||||
deny: overwrite.deny ? bot.utils.calculateBits(overwrite.deny) : "0",
|
||||
};
|
||||
})
|
||||
? options.permissionOverwrites?.map((overwrite) => ({
|
||||
id: overwrite.id.toString(),
|
||||
type: overwrite.type,
|
||||
allow: overwrite.allow ? bot.utils.calculateBits(overwrite.allow) : null,
|
||||
deny: overwrite.deny ? bot.utils.calculateBits(overwrite.deny) : null,
|
||||
}))
|
||||
: undefined,
|
||||
reason,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user