Simple way of preventing spaces from being added to themselves
This commit is contained in:
parent
50f4a11f00
commit
e93072af2e
1 changed files with 7 additions and 0 deletions
|
@ -694,6 +694,13 @@ class GPTBot:
|
||||||
if isinstance(room, MatrixRoom):
|
if isinstance(room, MatrixRoom):
|
||||||
room = room.room_id
|
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", {
|
await self.matrix_client.room_put_state(space, "m.space.child", {
|
||||||
"via": [room.split(":")[1], space.split(":")[1]],
|
"via": [room.split(":")[1], space.split(":")[1]],
|
||||||
}, room)
|
}, room)
|
||||||
|
|
Loading…
Reference in a new issue