#VoiceState
1 messages · Page 1 of 1 (latest)
you should use the instancce of the voicestate event and not the class
sorry, i am little confused, i am quite new to this
you need to listen to the VoiceStateUpdateEvent event
as in, subscibe to it
the event contains the new state and the old state of the user which fired the event (and also the user_id ofc)
i am
can you show your code then?
sure
@bot.listen(hikari. VoiceStateUpdateEvent )
async def vc_join(event):
print(hikari.VoiceState.user_id)
sorry
it was VoiceStateUpdateEvent
just tested smth
yes, and then you can use event.old_state.user_id and/or event.state.user_id
ok thanks
and other properties/methods that the VoiceState class provides ofc
Also how can i make this only trigger if a user joins?
check the old_state and the new state for a channel
but remember, when they change channel, they still join a new channel 😉
what would event.old_state.user_id return? cause for me it returns Traceback (most recent call last):
print(event.old.state.user_id)
^^^^^^^^^
AttributeError: 'VoiceStateUpdateEvent' object has no attribute 'old'```
am i missing anything?
its old_state
oh mb