Fixed a bug where adding an account replaced the main.py file
authorGeorgios Atheridis <atheridis@tutamail.com>
Wed, 1 Jun 2022 11:25:05 +0000 (14:25 +0300)
committerGeorgios Atheridis <atheridis@tutamail.com>
Wed, 1 Jun 2022 11:25:05 +0000 (14:25 +0300)
aptbot/args_logic.py

index 8d143a2f064e5634e88133d146893184a7ed8a2c..3f715639f9525345608d775097d948500a579766 100644 (file)
@@ -24,10 +24,13 @@ def add_account(s: socket.socket, acc: str):
         pass
     os.makedirs(account_path, exist_ok=True)
 
-    shutil.copyfile(
-        os.path.join(os.path.dirname(os.path.realpath(__file__)), "resources/main.py"),
-        os.path.join(account_path, "main.py"),
-    )
+    if not os.path.exists(os.path.join(account_path, "main.py")):
+        shutil.copyfile(
+            os.path.join(
+                os.path.dirname(os.path.realpath(__file__)), "resources/main.py"
+            ),
+            os.path.join(account_path, "main.py"),
+        )
 
     command = BotCommands.JOIN.value
     channel = acc