Upgrade matrix-nio to 0.25 #135

Merged
imbev merged 2 commits from subDesTagesMitExtraKaese/simplematrixbotlib:authenticated-media into master 2025-06-17 23:21:53 +02:00

The matrix media api used in matrix-nio v0.24 is deprecated.
smbl can't download media files on homeservers that implement matrix v1.11.
It is fixed in matrix-nio v0.25: https://github.com/matrix-nio/matrix-nio/pull/520

This PR will allow both matrix-nio ^0.24 and ^0.25.

code to reproduce the download error:

import nio

@bot.listener.on_custom_event(nio.RoomMessage)
async def on_message(room, event):
  if not isinstance(event, (nio.RoomMessageAudio,
                            nio.RoomEncryptedAudio,
                            nio.RoomMessageVideo,
                            nio.RoomEncryptedVideo)):
    return
    
  response = await bot.async_client.download(mxc=event.url)
  if isinstance(response, nio.responses.DownloadError):
    print(response)
  else:
    print("You aren't running a recent matrix homeserver")

There are mentions of breaking changes in the matrix-nio changelog: https://github.com/matrix-nio/matrix-nio/blob/main/CHANGELOG.md

The matrix media api used in matrix-nio v0.24 is deprecated. smbl can't download media files on homeservers that implement matrix v1.11. It is fixed in matrix-nio v0.25: https://github.com/matrix-nio/matrix-nio/pull/520 This PR will allow both matrix-nio ^0.24 and ^0.25. code to reproduce the download error: ```python import nio @bot.listener.on_custom_event(nio.RoomMessage) async def on_message(room, event): if not isinstance(event, (nio.RoomMessageAudio, nio.RoomEncryptedAudio, nio.RoomMessageVideo, nio.RoomEncryptedVideo)): return response = await bot.async_client.download(mxc=event.url) if isinstance(response, nio.responses.DownloadError): print(response) else: print("You aren't running a recent matrix homeserver") ``` There are mentions of breaking changes in the matrix-nio changelog: https://github.com/matrix-nio/matrix-nio/blob/main/CHANGELOG.md
Owner

Thank you for contributing!

Can you remove the upper limit ,<0.26 from the required version?

Thank you for contributing! Can you remove the upper limit `,<0.26` from the required version?
imbev merged commit a4e649091b into master 2025-06-17 23:21:53 +02:00
Sign in to join this conversation.
No description provided.