diff options
author | Matias Linares <matiaslina@openmailbox.org> | 2018-06-09 12:44:48 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@openmailbox.org> | 2018-06-09 12:44:48 -0300 |
commit | c0e320ce433bcd6551211904300563932e8339cb (patch) | |
tree | 11fbc452457ebc88eadc654854fe858ce04523ef /lib/Matrix/Client.pm6 | |
parent | 89fd81cf9909d804b08dbc8d47d2eb8f82d4c80c (diff) | |
download | perl6-matrix-client-c0e320ce433bcd6551211904300563932e8339cb.tar.gz |
Use $.whoami to retrieve the user-id
Diffstat (limited to 'lib/Matrix/Client.pm6')
-rw-r--r-- | lib/Matrix/Client.pm6 | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Matrix/Client.pm6 b/lib/Matrix/Client.pm6 index 3b8efdb..f2a5ec1 100644 --- a/lib/Matrix/Client.pm6 +++ b/lib/Matrix/Client.pm6 @@ -60,12 +60,12 @@ method register($username, $password, Bool :$bind-email? = False) { # User Data method profile(Str :$user-id?) { - my $id = $user-id // $!user-id; + my $id = $user-id // $.whoami; from-json($.get("/profile/" ~ $id).content); } method display-name(Str :$user-id?) { - my $id = $user-id // $!user-id; + my $id = $user-id // $.whoami; my $res = $.get("/profile/" ~ $id ~ "/displayname"); my $data = from-json($res.content); @@ -74,12 +74,12 @@ method display-name(Str :$user-id?) { } method change-display-name(Str:D $display-name!) { - so $.put("/profile/" ~ $!user-id ~ "/displayname", + so $.put("/profile/" ~ $.whoami ~ "/displayname", displayname => $display-name) } method avatar-url(Str :$user-id?) { - my $id = $user-id // $!user-id; + my $id = $user-id // $.whoami; my $res = $.get("/profile/" ~ $id ~ "/avatar_url"); my $data = from-json($res.content); @@ -92,7 +92,7 @@ multi method change-avatar(IO::Path $avatar) { } multi method change-avatar(Str:D $mxc-url!) { - $.put("/profile/" ~ $!user-id ~ "/avatar_url", + $.put("/profile/" ~ $.whoami ~ "/avatar_url", avatar_url => $mxc-url); } |