mirror of
https://codeberg.org/june64/mrvc.git
synced 2026-01-10 16:06:33 +01:00
accept room aliases instead of just room ids for ease of use
This commit is contained in:
parent
5ca794f435
commit
151b9080db
1 changed files with 13 additions and 1 deletions
14
main.go
14
main.go
|
|
@ -301,7 +301,19 @@ func main() {
|
||||||
fclient.WithTimeout(config.HomeserverVersionInfoTimeout),
|
fclient.WithTimeout(config.HomeserverVersionInfoTimeout),
|
||||||
)
|
)
|
||||||
|
|
||||||
joinedMembers, err := client.JoinedMembers(context.Background(), id.RoomID(config.Room))
|
var roomId id.RoomID
|
||||||
|
// Check, if given room is an alias and try to resolve it into a room id.
|
||||||
|
if strings.HasPrefix(config.Room, "#") {
|
||||||
|
resolvedAlias, err := client.ResolveAlias(context.Background(), id.RoomAlias(config.Room))
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
roomId = resolvedAlias.RoomID
|
||||||
|
} else {
|
||||||
|
roomId = id.RoomID(config.Room)
|
||||||
|
}
|
||||||
|
|
||||||
|
joinedMembers, err := client.JoinedMembers(context.Background(), roomId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue