diff options
author | Matias Linares <matiaslina@gmail.com> | 2020-03-24 19:37:44 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@gmail.com> | 2020-03-24 19:37:44 -0300 |
commit | e1abad7a57fd34ffb55c1d57d0b89ee91e55296b (patch) | |
tree | 12fe2d7b6d45543cb52f3b0382bc7de4bcc796fc | |
parent | 2fb9929b3acd2caf6ca0f0cf1e16f0872f7ae667 (diff) | |
parent | e50b8fa9e02b19ece80ebeb576051e451d3a7812 (diff) | |
download | perl6-matrix-client-e1abad7a57fd34ffb55c1d57d0b89ee91e55296b.tar.gz |
Merge branch 'master' into documentation
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | META6.json | 2 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rwxr-xr-x | examples/bot.raku (renamed from examples/bot.p6) | 4 | ||||
-rw-r--r-- | examples/doc-test.raku | 19 | ||||
-rw-r--r-- | examples/get-sync-json.raku | 12 | ||||
-rw-r--r-- | examples/rooms.raku (renamed from examples/rooms.p6) | 0 | ||||
-rw-r--r-- | examples/run.raku (renamed from examples/run.p6) | 2 | ||||
-rw-r--r-- | examples/send-message.raku (renamed from examples/send-message.p6) | 2 | ||||
-rw-r--r-- | t/40-response.t | 2 |
10 files changed, 41 insertions, 9 deletions
@@ -2,4 +2,5 @@ state file.json .precomp **/*/.precomp -todo.org
\ No newline at end of file +todo.org +*~
\ No newline at end of file @@ -9,7 +9,7 @@ "URI::Encode", "IO::Socket::SSL" ], - "description" : "Matrix client for Perl 6", + "description" : "Matrix client for Raku", "license" : "Artistic-2.0", "name" : "Matrix::Client", "perl" : "6.c", @@ -1,6 +1,6 @@ # Matrix::Client -A perl 6 library for [Matrix](https://matrix.org). +A [Raku](https://raku.org) library for [Matrix](https://matrix.org). ## Synopsis @@ -20,7 +20,7 @@ A perl 6 library for [Matrix](https://matrix.org). # Send a message to a random room that I'm in my $room = $client.joined-rooms.pick; say "Sending a message to {$room.name}"; - $room.send("Hello from perl6!"); + $room.send("Hello from Raku!"); ## Description diff --git a/examples/bot.p6 b/examples/bot.raku index 24ab1e6..8a9d206 100755 --- a/examples/bot.p6 +++ b/examples/bot.raku @@ -1,7 +1,7 @@ #!/usr/bin/env perl6 use v6; use lib "lib"; -use JSON::Tiny; +use JSON::Fast; use Matrix::Client; use Matrix::Client::Exception; @@ -34,7 +34,7 @@ class Bot { my $sync = { room => timeline => limit => 1 }; my $response = $!client.sync(sync-filter => $sync, since => $since); $since = $response.next-batch; - + for $response.joined-rooms -> $room { for $room.timeline .events diff --git a/examples/doc-test.raku b/examples/doc-test.raku new file mode 100644 index 0000000..0072c94 --- /dev/null +++ b/examples/doc-test.raku @@ -0,0 +1,19 @@ +use v6; +use lib <lib>; +use Matrix::Client; +use Data::Dump::Tree; + +my Matrix::Client $client .= new: + :home-server<https://matrix.deprecated.org>, + :access-token(%*ENV<MATRIX_ACCESS_TOKEN>); + +say $client.presence(“@matias:matrix.deprecated.org”); +#`[ +for ^10 -> $i { + my $presence = $i %% 2 ?? "online" !! "offline"; + say $client.presence.presence; + say "Setting presence $presence"; + $client.set-presence($presence, :status-message<woops>); + sleep 3; +} +] diff --git a/examples/get-sync-json.raku b/examples/get-sync-json.raku new file mode 100644 index 0000000..2db9c5a --- /dev/null +++ b/examples/get-sync-json.raku @@ -0,0 +1,12 @@ +use v6; +use Matrix::Client; + +sub MAIN($file? = 'sync.json') { + my $c = Matrix::Client.new(home-server => 'https://matrix.deprecated.org'); + $c.login: 'deprecated_bot', 'deprecatedbot'; + + my $res = $c.sync; + $file.IO.spurt($res.content); + + $c.logout; +} diff --git a/examples/rooms.p6 b/examples/rooms.raku index 4f0a0c7..4f0a0c7 100644 --- a/examples/rooms.p6 +++ b/examples/rooms.raku diff --git a/examples/run.p6 b/examples/run.raku index f78df16..af1b188 100644 --- a/examples/run.p6 +++ b/examples/run.raku @@ -1,4 +1,4 @@ -#!/usr/bin/env perl6 +#!/usr/bin/env raku use v6; use lib <lib>; use Matrix::Client; diff --git a/examples/send-message.p6 b/examples/send-message.raku index 4824be5..2a8202a 100644 --- a/examples/send-message.p6 +++ b/examples/send-message.raku @@ -1,4 +1,4 @@ -#!/usr/bin/env perl6 +#!/usr/bin/env raku use v6; use lib 'lib'; use Matrix::Client; diff --git a/t/40-response.t b/t/40-response.t index 61dd635..cc219b2 100644 --- a/t/40-response.t +++ b/t/40-response.t @@ -1,6 +1,6 @@ use lib 'lib'; use Test; -use JSON::Tiny; +use JSON::Fast; use Matrix::Response; plan 7; |