PermissionOverwriteManager using a Partial Record
Do you have any intention to remove the use of the
Partial<Record<keyof typeof PermissionFlagsBits, boolean | null>>
that is declared as PermissionOverwriteOptions
in the PermissionOverwriteManager ?
There are no enum to replace it yet but that would be cool to have consistency over it as it is for ChannelType
, OverwriteType
and such.15 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
hm why to remove it?
Just get rid of the
Record<keyof typeof...>
, it's a pain in the ass to work with it as it requires either a list of string constants or the use of some shady API to get the string from a property. It would be better to use enums like ChannelType
and OverwriteType
where you simply have to access a list of flags or a property that returns a bigint.
When using the PermissionOverwriteManager, you need to pass it down an object whose properties are string at some point...have u tried PermissonsBitField?
PermissionsBitField (extends BitField)
Data structure that makes it easy to interact with a permission bitfield. All GuildMembers have a set of permissions in their guild, and each channel in the guild may also have PermissionOverwrites for the member that override their default permissions.
PermissionBitField.Flags returns bigint, not strings
but it should accept also bitField
not as a property, computed properties cannot be of type BigInt
PermissionOverwriteManager#edit()
Edits permission overwrites for a user or role in this channel, or creates an entry if not already present.
they must be primitives, like string, number or boolean
here's a screenshot in case I did not make myself clear in the first place:
nah I meant bitfield instead of object
but looks like it's not accepting it
i'd rather use an array of bigints than an object whose properties are strings anyways
especially when the only purpose is to specify a list of permissions to include/exclude
but it accept bitfields
permissionOverweite.upsert(user , { }, {}, {allow: bitfield, deny: bitfield})
or not
but as edit not possible
but good thing to 🆙 any idea if this is being actually considered or should I open an issue on github?