Browse Source

Simple way of preventing spaces from being added to themselves

Kumi 1 year ago
parent
commit
e93072af2e
1 changed files with 7 additions and 0 deletions
  1. 7 0
      classes/bot.py

+ 7 - 0
classes/bot.py

@@ -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)