Fix matrix bot avatar

This commit is contained in:
Yohann D'ANELLO 2020-11-14 21:28:01 +01:00
parent 4238e49c11
commit 02ca1d1efe
1 changed files with 2 additions and 4 deletions

View File

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