Search code examples
discorddiscord.pynextcord

How to modify an user permissions for a specific channel nextcord


I want to create a channel where just me and who wrote the command can send messages. So far i have this code:

@commands.command()
    async def ticket(self, ctx, title, context):
        guild = ctx.guild
        member = ctx.author.name
        role = ctx.author.id
        category = guild.get_channel(1175421519439073380)
        channel = await category.create_text_channel(f'{member}-ticket')
        channel_id = channel.id
        getch = guild.get_channel(channel_id)
        if getch:
            embed = nextcord.Embed(
                title=title,
                description="<@&1146194171422572644> and <@696415634359189516> \n" + context,
                color=nextcord.Colour.green()
            )
            await channel.send(embed=embed)

I dont know how to make just me and the user to see the channel.


Solution

  • I might be late, but maybe you still need this.

    Do channel_id.set_permissions(member, permission=TrueOrFalse)

    You can find a list of permissions here: permissions