Skip to content
Snippets Groups Projects
Verified Commit 77a518de authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Allow setting avatar by MXC URL

parent 22229457
No related branches found
No related tags found
No related merge requests found
......@@ -107,8 +107,9 @@ cases["%s, hoer auf (.*)" % (NICK,)] = allow_user
cases["%s.*" % (NICK,)] = fallback
if network.is_connected():
# Set my nickname
# Set my nickname and avatar
matrix.set_displayname(NICK)
matrix.set_avatar(AVATAR)
# Join the room
matrix.join_room(ROOM_ID)
......
......@@ -93,6 +93,13 @@ class Matrix:
self._put(endpoint, json_data=content)
def set_avatar(self, avatar_url):
"""Set the account's avatar by MXC URL."""
endpoint = "/r0/profile/%s/avatar_url" % (self.matrix_id,)
content = {"avatar_url": avatar_url}
self._put(endpoint, json_data=content)
def send_room_message(self, room, text, msgtype="m.text"):
"""Send a message event to a room."""
content = {"msgtype": "m.text", "body": text}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment