E
E
Egor Frolov2020-12-04 15:20:04
Python
Egor Frolov, 2020-12-04 15:20:04

How to get the CATEGORY discord?

for some reason, my create_text_channel category indicates none and I need to somehow get the category, I did not find it in the documentation.

Piece of code:

ticket_channel = await payload.member.guild.create_text_channel('cool-channel')


XPw8Fn_3AzM.jpg?size=231x144&quality=96&proxy=1&sign=f481129eca3b02c7a4a17ea5c3fc7e29

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Nevzorov, 2020-12-04
@ddaia12

Category is just another type of channel. You can get a category object just like any other channel:

await guild.create_text_channel("channel_name", category=guild.get_channel(732068815788336617))
# или
await guild.create_text_channel("channel_name", category=discord.utils.get(guild.channels, name="Category"))
# или
await guild.get_channel(732068815788336617).create_text_channel("channel_name")
# или
await discord.utils.get(guild.channels, name="Category").create_text_channel("channel_name")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question