Fix AttributeError ('str' object has no attribute 'room_id') in react_to_event #2

Closed
opened 2024-12-31 13:40:35 +00:00 by ben · 1 comment
Owner

When _cb_decryption_fail calls react_to_event:

  File "/home/ben/projects/notflixbot/notflixbot/matrix.py", line 298, in _cb_decryption_fail
    await self.react_to_event(room.room_id, event.event_id,
                                              '$aCKYmfuVLVXFd49OmW40BSQX9nuD4NsqowzsMzbbk_g'
                                         MegolmEvent(source={'content': {'algorithm': 'm.megolm.v1.
aes-sha2', 'ciphertext': 'AwgCEqAMBSDjLr0uLMkpz0ZMv0pRsN0IX/lt8E4jk...
                                 '!CRwztTiHGQvFqgSjnc:sudo.is'
                             <nio.rooms.MatrixRoom object at 0x7f64b1867e20>
               <function MatrixClient.react_to_event at 0x7f64b1cda940>
           <notflixbot.matrix.MatrixClient object at 0x7f64b19af790>

  File "/home/ben/projects/notflixbot/notflixbot/matrix.py", line 498, in react_to_event
    room.room_id,
     '!CRwztTiHGQvFqgSjnc:sudo.is'

AttributeError: 'str' object has no attribute 'room_id'

The react_to_event method expects the room parameter to be an object, but _cb_decryption_fail passes a string instead.

When `_cb_decryption_fail` calls `react_to_event`: ```python3 File "/home/ben/projects/notflixbot/notflixbot/matrix.py", line 298, in _cb_decryption_fail await self.react_to_event(room.room_id, event.event_id, │ │ │ │ │ └ '$aCKYmfuVLVXFd49OmW40BSQX9nuD4NsqowzsMzbbk_g' │ │ │ │ └ MegolmEvent(source={'content': {'algorithm': 'm.megolm.v1. aes-sha2', 'ciphertext': 'AwgCEqAMBSDjLr0uLMkpz0ZMv0pRsN0IX/lt8E4jk... │ │ │ └ '!CRwztTiHGQvFqgSjnc:sudo.is' │ │ └ <nio.rooms.MatrixRoom object at 0x7f64b1867e20> │ └ <function MatrixClient.react_to_event at 0x7f64b1cda940> └ <notflixbot.matrix.MatrixClient object at 0x7f64b19af790> File "/home/ben/projects/notflixbot/notflixbot/matrix.py", line 498, in react_to_event room.room_id, └ '!CRwztTiHGQvFqgSjnc:sudo.is' AttributeError: 'str' object has no attribute 'room_id' ``` The `react_to_event` method expects the `room` parameter to be an object, but `_cb_decryption_fail` passes a string instead.
ben closed this issue 2024-12-31 13:41:56 +00:00
Author
Owner

This was also opened as ops/meta#1, fixed half of it.

This was also opened as ops/meta#1, fixed half of it.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ben/notflixbot#2
No description provided.