Manufacture PermissionOverwrites object
I'm wondering if it's possible to manufacture a
PermissionOverwrites
object.
I can create an object with all the same properties, but the API rejects the object. When I compare to one in the cache I can see that the object itself has a type of PermissionOverwrites
:
I figured out how to create a Permissions object within the overwrite, but I can't seem to figure out how to make the overwrite object itself a PermissionOverwrites
object.3 Replies
what exactly are you trying to do and what's the api error
I have a
/channel-list
function that allows users to join channels, when a channel is joined the corresponding button displays green. Sometimes the cache isn't updating fast enough, so the function that changes the color of the buttons doesn't know that a button's color needs to be updated.
Rather than fetching the channels, which results in hitting the API, I thought I could just add to the cache. But pushing a user ID with anything but a real PermissionOverwrites
object results in an error (this may be from somewhere else in the bot which looks at overwrites):
First tried just pushing to the Map with random text:
But honestly, maybe rather than messing with the cache I should just pass the button function a channel ID and change the color of the button regardless of what the cache says.