async def _voice_states(self): voices = [] for voice in await self._state._members_get_all("guild", key_id=self.id, name="voice"): if voice["channel_id"]: channel = await self.get_channel(int(voice["channel_id"])) if channel: voices.append(VoiceState(channel=channel, data=voice)) else: voices.append(VoiceState(channel=None, data=voice)) return voices
async def parse_voice_state_update(self, data, old): guild = await self._get_guild(utils._get_as_snowflake( data, "guild_id")) if guild: member = await guild.get_member(int(data["user_id"])) if member: channel = await self.get_channel( utils._get_as_snowflake(data, "channel_id")) if channel: before = None after = VoiceState(data=data, channel=channel) old_channel = await self.get_channel(old["channel_id"]) if old and old_channel: before = VoiceState(data=data, channel=old_channel) self.dispatch("voice_state_update", member, before, after)