#permission overwrites please
1 messages · Page 1 of 1 (latest)
Example for a PermissionOverwrite Object. Without guarantee:
PermissionOverwrite(
id=role.id #--> your role ID (or User ID)
target=interactions.Role #--> the type: Role/User
allow=[interactions.Permissions.VIEW_CHANNEL] #--> list of allowed Permissions
deny=[interactions.Permissions.SEND_MESSAGES] #--> list of denied Permissions
)
I´m not your bro
list of targets is not possible, as far i know
you have to create overwrite for each role
overwrites = [
PermissionOverwrite(id=ctx.guild.id,type=0,deny=Permissions.VIEW_CHANNEL), # sets full privacy on ctx.guild.id
PermissionOverwrite(id=ctx.author_id,type=1,allow=Permissions.VIEW_CHANNEL), # sets view channel permission on ctx.author_id
]
new_channel = await ctx.guild.create_text_channel(channel_name, permission_overwrites=overwrites)
type=0 -> ID is RoleID
type=1 -> ID is UserID
you have to assign a permission to each role/user
guild.id is handled as roleid
and I'm with you, the docs could be better at this point
I also needed some time to get into that function ^^
especially that you could use 0/1 as type instead of a complete role/user-object
btw. you can use 0/1/2... at many points.
The "Objects" are Enumerate Variables
yes, I needed some time to check this. espacially for that function
just want to say I can relate to OPs confusion
I can understand the struggle cause there is no Guide for Permissions.
But with some programming logic its not the big problem.
In channel create function is PermissionOverwrite as typehint for overwrites.
if you look in the docs for this it is relativly easy
yes, I think its more complicated for beginners rather then experienced coders
at least I was relative unexperienced as I was working the first time with that function / i.py
I thought SEND_MESSAGES > VIEW_CHANNELS according to docs?
i´m not sure. maybe this is enough
ah ok. good to know
list of permissions...
at first, deny VIEW_CHANNEL also denies SEND_MESSAGES
no need to set it for the same role twice
dude, you asked since 3 days the same weird questions
try to use pipes to combine different permissions in one assignment
allow=Permissions.SEND_MESSAGES | Permissions.ATTACH_FILES
❤️