Simple way of preventing spaces from being added to themselves

This commit is contained in:
Kumi 2023-05-12 07:54:29 +00:00
parent 50f4a11f00
commit e93072af2e
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -694,6 +694,13 @@ class GPTBot:
if isinstance(room, MatrixRoom):
room = room.room_id
if space == room:
self.logger.log(
f"Refusing to add {room} to itself", "warning")
continue
self.logger.log(f"Adding {room} to {space}...")
await self.matrix_client.room_put_state(space, "m.space.child", {
"via": [room.split(":")[1], space.split(":")[1]],
}, room)