Answer the question
In order to leave comments, you need to log in
Can't create a channel in a specific category?
The channel is created as it should, but it is created at the very top, and I need it to be in a category. I can not find the necessary thing on the API. There is a category, but it is not clear what to transfer there.
@bot.command()
async def create_channel(ctx):
name = ""+ctx.message.author.name
guild = ctx.message.guild
await guild.create_voice_channel(name, position=3)
Answer the question
In order to leave comments, you need to log in
category
The channel-category object is passed as an
argument .
@bot.command()
async def cmdname(ctx):
category = bot.get_channel(788488692362607662) # ID категории
await category.create_voice_channel(ctx.author.name)
# ИЛИ
await ctx.guild.create_voice_channel(ctx.author.name, category = category)
@bot.command()
async def create_channel(ctx):
name = ""+ctx.message.author.name
guild = ctx.message.guild
await guild.create_voice_channel(name, position=3, category=CATEGORY_ID)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question