#How do I get all the categories in a guild?

1 messages · Page 1 of 1 (latest)

rough citrus
#

Not sure how to go about it

ebon thunder
#

you will need to fetch all the channels, and then sort the categories out from said channels.

rough citrus
#

how do I do that?

I saw something like this:

filter(lambda c: c.type is hikari.ChannelType.GUILD_CATEGORY, bot.cache.get_guild_channels_view_for_guild(...).values())

But it doesn't return anything

ebon thunder
#

your cache might be empty

#

try just simply getting the channels from the server, and say listing out the names

#

so fetching the channels, then doing a for loop through them

#

cache is great, but im fairly certain its only if something has been saved to the bots memory basically

rough citrus
ebon thunder
#

I think thats what you want

#

or something around it

rough citrus
#

thanks

#

how do I get the guild object?

#

nvm

coral blade
#

you typically don't need the object for anything in hikari.

#

get_ always indicates a cache call. fetch_ indicates an http request to discord.

#

so if get_guild_channels_view_for_guild didn't have the channels neither will Guild.get_channels. they use the same cache.