Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
api/runtimeconfig.json
database
database/currency.json
database/items.json
database/isotokens.json
Expand All @@ -7,7 +8,6 @@ database/presence.json
database/user_data.json
database/weather.json
database/automod.json
database/isobank/*
*.log
*.pyc
logs
Expand Down
8 changes: 8 additions & 0 deletions cogs/isocoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
# Imports
import random
import json
import os
import discord
from discord import ApplicationContext, SlashCommandGroup
from discord.ext import commands

# Variables
if not os.path.isdir("database"): # TEMPORARY: Allow cog to handle "database" directory generation (for now)
os.mkdir("database")
if not os.path.isfile("database/isotokens.json"): # Generate database file, if missing.
with open("database/isotokens.json", 'x', encoding="utf-8") as f:
json.dump({}, f)
f.close()

with open("database/isotokens.json", 'r', encoding="utf-8") as f: isocoins = json.load(f)

def save():
Expand Down
1 change: 0 additions & 1 deletion database/automod.json

This file was deleted.

5 changes: 0 additions & 5 deletions database/currency.json

This file was deleted.

1 change: 0 additions & 1 deletion database/isobank/accounts.json

This file was deleted.

1 change: 0 additions & 1 deletion database/isobank/auth.json

This file was deleted.

1 change: 0 additions & 1 deletion database/isocard.json

This file was deleted.

1 change: 0 additions & 1 deletion database/isotokens.json

This file was deleted.

1 change: 0 additions & 1 deletion database/items.json

This file was deleted.

1 change: 0 additions & 1 deletion database/levels.json

This file was deleted.

1 change: 0 additions & 1 deletion database/presence.json

This file was deleted.

1 change: 0 additions & 1 deletion database/user_data.json

This file was deleted.

1 change: 0 additions & 1 deletion database/weather.json

This file was deleted.

10 changes: 6 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def initial_setup():
"""Runs the initial setup for isobot's directories.\nThis creates missing directories, new log files, as well as new databases for any missing `.json` database files."""
# Create required client directories
try:
paths = ["database", "config", "logs", "themes"]
paths = ["database", "database/isobank", "config", "logs", "themes"]
for p in paths:
if not os.path.isdir(p):
logger.warn(f"'{p}' directory appears to be missing. Created new directory for '{p}'.", module="main/Setup", nolog=True)
Expand All @@ -40,16 +40,18 @@ def initial_setup():

# Generating database files
try:
databases = ["automod", "currency", "isocard", "isotokens", "items", "levels", "presence", "user_data", "weather"]
databases = ["automod", "currency", "isocard", "items", "levels", "presence", "user_data", "weather", "isobank/accounts", "isobank/auth"]
for f in databases:
if not os.path.isfile(f"database/{f}.json"):
logger.warn(f"[main/Setup] '{f}.json' was not found in database directory. Creating new database...", module="main/Setup", nolog=True)
if f == "currency":
with open(f"database/{f}.json", 'x', encoding="utf-8") as f:
json.dump({"treasury": 1000000, "wallet": {}, "bank": {}}, f, encoding="utf-8")
json.dump({"treasury": 100000000, "wallet": {}, "bank": {}}, f)
f.close()
else:
with open(f"database/{f}.json", 'x', encoding="utf-8") as f:
json.dump({}, f, encoding="utf-8")
json.dump({}, f)
f.close()
time.sleep(0.5)
except IOError as e:
logger.error(f"Failed to make database file: {e}", module="main/Setup")
Expand Down