#How to create private channel on button click

1 messages · Page 1 of 1 (latest)

hollow mango
#

I kind of read almost all the official documentation, but I still didn’t understand how to create a private channel and add a user to it

||Sorry for bad english ||

c = await ctx.guild.create_channel(0, f"{user.username}_{user.discriminator}" )
supple baneBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

night harness
#

create a channel and then you have to modify the permissions

#

everyone role should be set to NOT see the channel, and then one user to see it

hollow mango
#

To change the permissions to the channel through the bot, I have to do something like PermissionOverwrite?

night harness
#

yes

hollow mango
#

Ok, I'll try

hollow mango
#

Could you show me a code example?

ember monolith
#
po = interactions.PermissionOverwrite(id=ctx.guild.id, type=0) # everyone role
po.add_denies(interactions.Permissions.VIEW_CHANNEL)
await ctx.guild.create_channel(channel_type=your_type, name=your_name, permission_overwrites=po)
#

Should work like this

hollow mango
#

Super! I just misunderstood what needed to be specified in "type". Thanks for the help.

ember monolith
#

The channel_type or the normal type in Overwrites?

hollow mango
#

normal type in Overwrites

ember monolith
#

type=0 is for roles and type=1 is for users

hollow mango
#

Thanks