simplematrixbotlib 2.12.2__tar.gz → 2.12.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: simplematrixbotlib
3
- Version: 2.12.2
3
+ Version: 2.12.3
4
4
  Summary: An easy to use bot library for the Matrix ecosystem written in Python.
5
5
  License: MIT
6
6
  Keywords: simple,matrix,bot,lib,simple-matrix-bot-lib
@@ -28,7 +28,7 @@ Project-URL: Repository, https://codeberg.org/imbev/simplematrixbotlib
28
28
  Description-Content-Type: text/markdown
29
29
 
30
30
  # Simple-Matrix-Bot-Lib
31
- (Version 2.12.2)
31
+ (Version 2.12.3)
32
32
 
33
33
  Simple-Matrix-Bot-Lib is a Python bot library for the Matrix ecosystem built on [matrix-nio](https://github.com/poljar/matrix-nio).
34
34
 
@@ -1,5 +1,5 @@
1
1
  # Simple-Matrix-Bot-Lib
2
- (Version 2.12.2)
2
+ (Version 2.12.3)
3
3
 
4
4
  Simple-Matrix-Bot-Lib is a Python bot library for the Matrix ecosystem built on [matrix-nio](https://github.com/poljar/matrix-nio).
5
5
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "simplematrixbotlib"
3
- version = "2.12.2"
3
+ version = "2.12.3"
4
4
  description = "An easy to use bot library for the Matrix ecosystem written in Python."
5
5
  authors = ["imbev <imbev@protonmail.com>"]
6
6
  license = "MIT"
@@ -314,7 +314,7 @@ class Api:
314
314
 
315
315
  await self._send_room(room_id=room_id, content=content)
316
316
 
317
- async def send_reaction(self, room_id: str, event, key: str):
317
+ async def send_reaction(self, room_id: str, event: str | nio.events.room_events.Event, key: str):
318
318
  """
319
319
  Send a reaction to a message in a Matrix room.
320
320
 
@@ -323,18 +323,23 @@ class Api:
323
323
  room_id : str
324
324
  The room id of the destination of the message.
325
325
 
326
- event :
327
- The event object you want to react to.
326
+ event : str | nio.events.room_events.Event
327
+ The event object or its event id you want to react to.
328
328
 
329
329
  key: str
330
330
  The content of the reaction. This is usually an emoji, but may technically be any text.
331
331
  """
332
332
 
333
+ if isinstance(event, nio.events.room_events.Event):
334
+ event_id = event.event_id
335
+ else:
336
+ event_id = event
337
+
333
338
  await self._send_room(
334
339
  room_id=room_id,
335
340
  content={
336
341
  "m.relates_to": {
337
- "event_id": event.event_id,
342
+ "event_id": event_id,
338
343
  "key": key,
339
344
  "rel_type": "m.annotation"
340
345
  }