#VoiceStateUpdate event
1 messages · Page 1 of 1 (latest)
get the voice channel ID from one of the states, (old/new)
then you can do bot.cache.get_voice_states_view_for_channel(guild_id, channel_id)
you can call len(...) on the whole thing
and that will give you the amount of members in the channel
How to do it inside the plugin?
Show your code
Wait a bit
from lightbulb import Plugin
from hikari import (
VoiceStateUpdateEvent
)
from config import config
plugin = Plugin('voiceStateUpdate')
@plugin.listener(VoiceStateUpdateEvent)
async def voiceStateUpdate(event: VoiceStateUpdateEvent):
if event.state.channel_id == config['voice_create_id']:
private_voice = await event.state.member.get_guild().create_voice_channel(f'Канал {event.state.member.username}', category = config['voice_category_id'])
await event.state.member.edit(voice_channel = private_voice)
if event.old_state != None:
print(event.state.members)
def load(client) -> None:
client.add_plugin(plugin)
def unload(client) -> None:
client.remove_plugin(plugin)
You can access the cache from plugin I'm pretty sure
yeah, from plugin.bot/plugin.app