aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2017-04-12 19:22:26 -0300
committerMatias Linares <matiaslina@openmailbox.org>2017-04-12 19:22:26 -0300
commit4658cf8b18ed5a2f1ef86bf156710f12252b296e (patch)
treed5b5465c7162b1a3460ddbb6e72a63290d16ef43
parent846f9af582cd2d68331a334e2933d2b3c82ad099 (diff)
downloadperl6-matrix-client-4658cf8b18ed5a2f1ef86bf156710f12252b296e.tar.gz
Update README/examples
-rw-r--r--README.md7
-rwxr-xr-xexamples/bot.p612
-rw-r--r--examples/rooms.p62
3 files changed, 17 insertions, 4 deletions
diff --git a/README.md b/README.md
index 901b72e..137d50b 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,11 @@
A perl 6 library for [Matrix](https://matrix.org).
+## Status
+
+This project is in early development. A lot of methods returns a raw
+`HTTP::Response` and not something from this library.
+
## Examples
From the `examples` directory:
@@ -15,7 +20,7 @@ From the `examples` directory:
$client.login: @*ARGS[0], @*ARGS[1];
# Show all joined rooms
- say $client.rooms;
+ say $client.rooms(:sync);
# And finally logout.
$client.logout
diff --git a/examples/bot.p6 b/examples/bot.p6
index cfc1247..aa55fd8 100755
--- a/examples/bot.p6
+++ b/examples/bot.p6
@@ -5,7 +5,7 @@ use JSON::Tiny;
use Matrix::Client;
class Bot {
- has $!name = "deprecated";
+ has $!name = "!d";
has $!username is required;
has Bool $!register = False;
has @!room-ids;
@@ -28,7 +28,7 @@ class Bot {
}
method shutdown() {
- $!client.finish;
+ $!client.save-auth-data;
}
method listen() {
@@ -77,11 +77,18 @@ sub MAIN(Str:D $username, Str:D $password, :$home-server = "https://matrix.depre
say "Someone is saying hi!";
"Hello @ {DateTime.now}"
}
+ when /poop/ {
+ parse-names "PILE OF POO"
+ }
+ when /wink/ {
+ parse-names "WINKING FACE"
+ }
default { say "Dunno what's telling me"; Str }
}
};
signal(SIGINT).tap({
+ say "Bye";
$bot.shutdown;
exit 0;
});
@@ -91,6 +98,7 @@ sub MAIN(Str:D $username, Str:D $password, :$home-server = "https://matrix.depre
if !$res.is-success {
warn $res.status-line;
warn $res.content;
+ die "Error joinig to rooms";
}
}
diff --git a/examples/rooms.p6 b/examples/rooms.p6
index 6af04bc..7a2de98 100644
--- a/examples/rooms.p6
+++ b/examples/rooms.p6
@@ -4,4 +4,4 @@ use Matrix::Client;
my $c = Matrix::Client.new: :home-server<https://matrix.deprecated.org>;
$c.login: @*ARGS[0], @*ARGS[1];
-say $c.rooms;
+say $c.rooms(:sync);