1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

Fix matrix bot avatar

This commit is contained in:
Yohann D'ANELLO 2020-11-14 21:28:01 +01:00
parent 4238e49c11
commit 02ca1d1efe

View File

@ -16,10 +16,8 @@ class Command(BaseCommand):
if not os.path.isfile(".matrix_avatar"): if not os.path.isfile(".matrix_avatar"):
stat_file = os.stat("corres2math/static/logo.png") stat_file = os.stat("corres2math/static/logo.png")
with open("corres2math/static/logo.png", "rb") as f: with open("corres2math/static/logo.png", "rb") as f:
resp, _ = Matrix.upload(f, filename="logo.png", content_type="image/png", resp = Matrix.upload(f, filename="logo.png", content_type="image/png",
filesize=stat_file.st_size) filesize=stat_file.st_size)[0][0]
if not hasattr(resp, "content_uri"):
raise Exception(resp)
avatar_uri = resp.content_uri avatar_uri = resp.content_uri
with open(".matrix_avatar", "w") as f: with open(".matrix_avatar", "w") as f:
f.write(avatar_uri) f.write(avatar_uri)