GregSutcliffe / maubot-meetings

A Maubot plugin for running meetings in Matrix
Other
9 stars 5 forks source link

error getting powerlevels if bot has powerlevel 0 #9

Closed ryanlerch closed 1 year ago

ryanlerch commented 1 year ago

When trying to start a meeting in a room where the powerlevel of the bot is 0, for the self.client.state_store.get_power_levels(evt.room_id) call results in None -- for some reason, a user with powerlevel 0 cannot see the powerlevels?

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/mautrix/client/syncer.py", line 235, in _catch_errors
    await handler(data)
  File "/usr/local/lib/python3.11/site-packages/maubot/handlers/command.py", line 154, in __call__
    return await self.__mb_func__(self.__bound_instance__, evt, **call_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/maubot/com.ansible.meetings-v0.1.1-ts1694144448495.mbp/meetings/__init__.py", line 135, in startmeeting
    if not await self.check_pl(evt):
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/maubot/com.ansible.meetings-v0.1.1-ts1694144448495.mbp/meetings/__init__.py", line 38, in check_pl
    permit = pls.get_user_level(evt.sender) >= self.config["powerlevel"]
             ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_user_level'
GregSutcliffe commented 1 year ago

I can't replicate this @ryanlerch, I'm afraid. My powerlevel-0 bot can check my powerlevel and deny me access if required:

# Confirm powerlevel
Gwmngilfen changed the power level of ER Maubot from Default to Custom (1).
Gwmngilfen changed the power level of ER Maubot from Custom (1) to Default.
# config min level to 50
Gwmngilfen> !sm
ER Maubot> Meeting started at 2023-09-08 09:24:07 UTC
The Meeting name is 'Meeting Test Meeting started 2023-09-08 09:24:07'
# wipe db and config min level to 150
Gwmngilfen> !sm
ER Maubot> You do not have permission to start a meeting

Is there anything special about your rooms? I've noticed my own powerlevel getting set to 1 instead of 0 in some Fedora rooms....