aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2019-07-16 11:51:36 +0200
committerPatrick Spek <p.spek@tyil.nl>2019-07-16 11:51:36 +0200
commit93405a9db414fb957eaa805681206f93e76e2514 (patch)
tree4a4cba3247aab09c719c2f4018c4471acb9a5f8f
parent2dd14b56e266831714af5ada30310d67d61b15a3 (diff)
downloadMatrix::Bot-93405a9db414fb957eaa805681206f93e76e2514.tar.gz
Matrix::Bot-93405a9db414fb957eaa805681206f93e76e2514.tar.bz2
Fix up invites from rooms with aliases
-rw-r--r--lib/Matrix/Bot.pm67
-rw-r--r--lib/Matrix/Bot/EventWrapper/RoomInvite.pm62
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/Matrix/Bot.pm6 b/lib/Matrix/Bot.pm6
index a1176f5..211fabd 100644
--- a/lib/Matrix/Bot.pm6
+++ b/lib/Matrix/Bot.pm6
@@ -155,11 +155,12 @@ method run ()
room => $event.room-id,
:$event,
;
+ my Str @aliases;
for $event.events -> $meta {
given $meta.type.fc {
when "m.room.canonical_alias" {
- %data<aliases>.push: $meta.content<alias>;
+ @aliases.append: $meta.content<alias>;
}
when "m.room.name" {
%data<name> = $meta.content<name>;
@@ -176,7 +177,7 @@ method run ()
}
}
- my $wrapper = Matrix::Bot::EventWrapper::RoomInvite.new(|%data);
+ my $wrapper = Matrix::Bot::EventWrapper::RoomInvite.new(|%data, :@aliases);
my $response = $plugin.handle-invite($wrapper);
@@ -209,7 +210,7 @@ method run ()
# If the handler returns a string, conveniently send it back to the
# originating channel.
- if ($reply ~~ Str && $reply ne "") {
+ if ($reply ~~ Str:D && $reply ne "") {
$!client.send($event.room_id, $reply, :type<m.notice>);
}
})
diff --git a/lib/Matrix/Bot/EventWrapper/RoomInvite.pm6 b/lib/Matrix/Bot/EventWrapper/RoomInvite.pm6
index c029e19..7d9c4eb 100644
--- a/lib/Matrix/Bot/EventWrapper/RoomInvite.pm6
+++ b/lib/Matrix/Bot/EventWrapper/RoomInvite.pm6
@@ -12,7 +12,7 @@ has Str $.room is required;
has Str $.name is required = "";
#| A list of aliases for the room.
-has Str @.aliases = [];
+has Str @.aliases;
#| The user that invited the client.
has Str $.user is required;