#having an issue with detecting mute state of user

1 messages · Page 1 of 1 (latest)

chrome imp
#

I'm using 5.0.0 latest and the statement I'm using works to a point
(This is also tested with and without interactions.ext.jurigged)

@listen()
async def on_voice_user_mute(event: VoiceUserMute):
    if event.author.id == bot.owner.id:
        print(event.author.mute) #get state of event (True of False) debug line
        if event.author.mute == True:
            await req_light(3) # Change to Blue
        else:
            await req_light(1) # Change to Red

The event triggers correctly when the user mutes and un-mutes, but the line below to get the bool state it always returns False even if the user is muted.

print(event.author.mute)

any further insight into how to get this to detect the mute state of the user would be welcome

outer comet
#

My gut says this is a library bug, but, I don't I don't have time to actually check it right now

chrome imp
hollow shoal
#

@chrome imp check user.self_mute

outer comet
#

Oh, I hate that. We should probably put a strong notice in the docs telling people that mute means server mute

hollow shoal
#

It reflects the API spec 🙃

#

I'll probably abstract it away from the API and have

user.muted - which returns if either of the below are true

user.self_muted
user.server_muted

outer comet
#

Yeah, sounds good

chrome imp
#

it seems I have fallen back into the issue of voicestates not knowing what user i'm trying to talk about

@listen()
async def on_voice_user_mute(event: VoiceUserMute):
    if event.author.id == bot.owner.id:
        print(VoiceState.self_mute) #get state of event (true of false) debug line
#

output: ```python
<member 'self_mute' of 'VoiceState' objects>

#

I'm not sure how to pass the event.author.id to voice states class

#

any code help would be very welcome

hollow shoal
#

You're referencing a class, not the event

event not VoiceState

chrome imp
#
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/interactions/client/client.py", line 571, in _async_wrap
    await _coro(_event, *_args, **_kwargs)
  File "/usr/local/lib/python3.10/site-packages/interactions/models/internal/callback.py", line 32, in __call__
    return await self.callback(*args, **kwargs)
  File "/root/botv2.py", line 48, in on_voice_user_mute
    print(event.self_mute) #get state of event (true of false) debug line
AttributeError: 'VoiceUserMute' object has no attribute 'self_mute'
chrome imp
chrome imp
#

ah, i was missing .state

#

many thanks @hollow shoal