simplify invite handling

this also fixes a bug where the bot only joined invite-only rooms
whoops
master
lub 5 years ago
parent 82bce8415d
commit 77e4515b3d

@ -327,11 +327,8 @@ function Invoke-MatrixSync {
#.PSObject.Properties because the rooms under .invite are [NoteProperty] #.PSObject.Properties because the rooms under .invite are [NoteProperty]
$room_ids = $response.rooms.invite.PSObject.Properties.Name $room_ids = $response.rooms.invite.PSObject.Properties.Name
foreach($room_id in $room_ids) { foreach($room_id in $room_ids) {
$invites = $response.rooms.invite.$room_id.invite_state.events | Where-Object {$_.content.join_rule -eq 'invite'}
foreach($invite in $invites) {
Join-MatrixRoom -RoomId $room_id Join-MatrixRoom -RoomId $room_id
} }
}
return $response.next_batch return $response.next_batch
} }

Loading…
Cancel
Save