Skip to content

Commit

Permalink
Merge pull request #41 from notsniped/autogenerate-serverconf-databas…
Browse files Browse the repository at this point in the history
…e-file

Auto-generate server configuration database upon initial bot setup
  • Loading branch information
notsniped authored Apr 29, 2024
2 parents 9f05bb9 + a599e44 commit 3906375
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ __pycache__
logs
snipe.json
editsnipe.json
database.json
7 changes: 5 additions & 2 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ def create_files():
open("logs/errors.log", 'x', encoding="utf-8")

# Create database files
databases = ["snipe.json", "editsnipe.json"]
databases = ["snipe.json", "editsnipe.json", "database.json"]
for db in databases:
if not os.path.isfile(db):
print(f"[!] \"{db}\" appears to be missing from directory. Creating file...")
with open(db, 'x', encoding="utf-8") as f:
json.dump({}, f)
if db == "database.json":
json.dump({"audit_channel": {}}, f)
else:
json.dump({}, f)
f.close()

create_files()
Expand Down
3 changes: 0 additions & 3 deletions database.json

This file was deleted.

0 comments on commit 3906375

Please sign in to comment.