Skip to content

Commit

Permalink
Removed users file if there is no data
Browse files Browse the repository at this point in the history
  • Loading branch information
Era Dorta committed Feb 28, 2022
1 parent 78cf4cc commit 24a5c4a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions signalblast/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ async def remove(self, element: str) -> None:
await self.save_to_file()

async def save_to_file(self):
if len(self.data) == 0:
os.remove(self.save_path)
return

with open(self.save_path, "w") as f:
for i, subscriber in enumerate(self.data):
if i < len(self.data) - 1:
Expand Down

0 comments on commit 24a5c4a

Please sign in to comment.