From c0e320ce433bcd6551211904300563932e8339cb Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sat, 9 Jun 2018 12:44:48 -0300 Subject: Use $.whoami to retrieve the user-id --- lib/Matrix/Client.pm6 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/Matrix') 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); } -- cgit v1.2.3-70-g09d2