python

How to create a new channel using nextcord


I believe it goes something like this

@bot.command()
async def ticket(ctx, member, name):
  await create_text_channel(name = f'{member}', subject = "test channel")

Please correct me if I am wrong


Solution

  • @client.command()
    async def ticket(ctx, channelName):
        guild = ctx.guild
    
        embedTicket = nextcord.Embed(title = "Ticket", description="Sehr gut!")
        if ctx.author.guild_permissions.manage_channels:
            await guild.create_text_channel(name=f'{channelName}-ticket')
            await ctx.send(embed=embedTicket)
    

    This would be a way to do it.