Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Μ
µtrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Teckids
Projekt Hack-n-Fun
Libs
µtrix
Commits
77a518de
Verified
Commit
77a518de
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Allow setting avatar by MXC URL
parent
22229457
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/led_cheese.py
+2
-1
2 additions, 1 deletion
examples/led_cheese.py
mytrix.py
+7
-0
7 additions, 0 deletions
mytrix.py
with
9 additions
and
1 deletion
examples/led_cheese.py
+
2
−
1
View file @
77a518de
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
mytrix.py
+
7
−
0
View file @
77a518de
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment