#Getting member list out of GuildVoiceChannel

1 messages Β· Page 1 of 1 (latest)

feral sage
#

Hi,
I am trying to get a member list from a specific voice channel. I have the GuildVoiceChannel object and am pretty stuck with the task. How can I get this info out of said object?

In general I find it really hard to find stuff in the documentation since a lot of things seems to be too nested to really find a path from objects I have to those I am looking for. For example it took me 3 hours yesterday to get a guild object while already having the guild id available because I couldn't find a way from the BotApp/GatewayBot documentation to bot.rest.fetch_guild(). How do you guys look something like those problems up?

Thanks in advance πŸ™‚

sterile bronze
#

start by looking at the impl.cache and impl.rest modules they have almost all the methods you normally use.

#

as for getting the members in a voice channel

bot.cache.get_voice_states_view_for_channel(guild_id, channel_id)

feral sage
#

Thank you for both answers πŸ™‚

sterile bronze
#

happy to help!

feral sage
#

<hikari.internal.cache.CacheMappingView object at 0x0000013B61AFB070>
this is what it returns

sterile bronze
#

it's like a dictionary of key value pairs.

feral sage
#

Yeah that is what I am staring at. Trying to figure out how to access them

sterile bronze
#

and it prints what

#

should be id's

feral sage
#

User ids

#

yeah that works, thank you πŸ™‚

sterile bronze
#

treat it just like a dictionary

#

.items() .values() etc

feral sage
#

yeah, nice

#

Is it hard to create one of those by myself?

#

I have an instance where I would like to implement custom array indexes but I learned that is not a thing in python. A dictonary would be exactly that πŸ˜„

sterile bronze
#

my_dict = {"key1": 123, "key2": 456}

#

my_dict["key1"] returns 123

feral sage
#

awesome thanks

sterile bronze
#

sure thing.

queen steppe
#

carbs