4
31
Fork
You've already forked simplematrixbotlib
21

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
Copy link

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?
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 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
imbev/simplematrixbotlib!135
Reference in a new issue
imbev/simplematrixbotlib
No description provided.
Delete branch "subDesTagesMitExtraKaese/simplematrixbotlib:authenticated-media"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?