Open Tyil opened 5 years ago
Hey @Tyil,
What's your version of Matrix::Client
? I'm trying the same snippet without errors in the latest version (0.5.1)
% perl6
To exit type 'exit' or '^D'
> use Matrix::Client
Nil
> my $c = Matrix::Client.new(:home-server<https://matrix.deprecated.org>);
Matrix::Client.new(device-id => Str, home-server => "https://matrix.deprecated.org", access-token => "")
> $c.get-room-id('#deprecated:matrix.deprecated.org')
!CrhcYlwlZRJtxskYqv:matrix.deprecated.org
> $c.get-room-id('%23deprecated:matrix.deprecated.org')
!CrhcYlwlZRJtxskYqv:matrix.deprecated.org
> $c.get-room-id('#the-life-of-sjon:matrix.org')
!iwJJhLVhPkJqYLeaLg:matrix.org
The fix at the time was replacing # with %23.
Could you try with the latest version?
As an explanation of the error, the room alias is on the URI and not on the query params. Without escaping the #
the room alias is taken as a fragment identifier.
% curl 'https://matrix.deprecated.org/_matrix/client/r0/directory/room/%23the-life-of-sjon:matrix.org'
{
"room_id": "!iwJJhLVhPkJqYLeaLg:matrix.org",
"servers": [
"matrix.org"
]
}
% curl 'https://matrix.deprecated.org/_matrix/client/r0/directory/room/#the-life-of-sjon:matrix.org'
{
"errcode": "M_UNKNOWN",
"error": "Expected RoomAlias string to start with '#'"
}
And that's why you're seeing the M_UNKNOWN: Expected RoomAlias string to start with '#'
I'm not sure which version I have. I'll try to upgrade it to latest version with zef tomorrow to ensure I'm on the latest release.
-- With kind regards,
Patrick Spek
www: https://www.tyil.nl/ mail: p.spek@tyil.nl pgp: 1660 F6A2 DFA7 5347 322A 4DC0 7A6A C285 E2D9 8827
social: https://soc.fglt.nl/tyil git: https://gitlab.com/tyil/
I'm trying to get the Room ID using
get-room-id
, so I can start sending messages to the right room only.However, I keep getting the following error message:
This is confusing, as the string I'm passing does start with a
#
. Is there any way I can start looking to figure out where it's going wrong?